pkcs15-prkey: Simplify cleaning memory after failure

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18478
This commit is contained in:
Jakub Jelen 2019-10-23 09:22:44 +02:00 committed by Frank Morgner
parent 19f4c7e428
commit 6ce6152284
1 changed files with 1 additions and 4 deletions

View File

@ -260,10 +260,7 @@ int sc_pkcs15_decode_prkdf_entry(struct sc_pkcs15_card *p15card,
r = sc_asn1_decode_choice(ctx, asn1_prkey, *buf, *buflen, buf, buflen);
if (r < 0) {
/* This might have allocated something. If so, clear it now */
if (asn1_com_prkey_attr->flags & SC_ASN1_PRESENT &&
asn1_com_prkey_attr[0].flags & SC_ASN1_PRESENT) {
free(asn1_com_prkey_attr[0].parm);
}
free(info.subject.value);
}
if (r == SC_ERROR_ASN1_END_OF_CONTENTS)
return r;