Skip to content

Commit

Permalink
core: ltc: fix double free in dsa_import()
Browse files Browse the repository at this point in the history
Upstream commit 1e260eeaae43 ("fir coverity finding: dsa_import double
free").

Fixes: #1962
Signed-off-by: Jerome Forissier <[email protected]>
  • Loading branch information
jforissier committed Nov 22, 2017
1 parent 24bb751 commit 2fc7c68
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/lib/libtomcrypt/src/pk/dsa/dsa_import.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,12 @@ int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key)
PKA_DSA, tmpbuf, &tmpbuf_len,
LTC_ASN1_SEQUENCE, params, 3);
if (err != CRYPT_OK) {
XFREE(tmpbuf);
goto LBL_ERR;
}

if ((err=der_decode_integer(tmpbuf, tmpbuf_len, key->y)) != CRYPT_OK) {
XFREE(tmpbuf);
goto LBL_ERR;
}

Expand All @@ -152,7 +154,6 @@ int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key)

return CRYPT_OK;
LBL_ERR:
XFREE(tmpbuf);
mp_clear_multi(key->p, key->g, key->q, key->x, key->y, NULL);
return err;
}
Expand Down

0 comments on commit 2fc7c68

Please sign in to comment.