Merge pull request #144 from libtom/fix/coverity-dsa_import-double-free

fix coverity finding: dsa_import double free
This commit is contained in:
karel-m 2017-02-28 01:17:18 +01:00 committed by GitHub
commit 30382d0e31

View File

@ -99,14 +99,16 @@ int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key)
goto LBL_ERR;
}
err = der_decode_subject_public_key_info(in, inlen,
PKA_DSA, tmpbuf, &tmpbuf_len,
LTC_ASN1_SEQUENCE, params, 3);
err = der_decode_subject_public_key_info(in, inlen, 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;
}
@ -125,7 +127,6 @@ LBL_OK:
return CRYPT_OK;
LBL_ERR:
XFREE(tmpbuf);
mp_clear_multi(key->p, key->g, key->q, key->x, key->y, NULL);
return err;
}