pkcs15-pubkey: Avoid memory leaks
Thanks oss-fuzz https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18758
This commit is contained in:
parent
cc917b541f
commit
0977b5496a
|
@ -311,6 +311,9 @@ int sc_pkcs15_decode_pukdf_entry(struct sc_pkcs15_card *p15card,
|
||||||
memset(gostr3410_params, 0, sizeof(gostr3410_params));
|
memset(gostr3410_params, 0, sizeof(gostr3410_params));
|
||||||
|
|
||||||
r = sc_asn1_decode(ctx, asn1_pubkey, *buf, *buflen, buf, buflen);
|
r = sc_asn1_decode(ctx, asn1_pubkey, *buf, *buflen, buf, buflen);
|
||||||
|
if (r < 0) {
|
||||||
|
free(der->value);
|
||||||
|
}
|
||||||
if (r == SC_ERROR_ASN1_END_OF_CONTENTS)
|
if (r == SC_ERROR_ASN1_END_OF_CONTENTS)
|
||||||
goto err;
|
goto err;
|
||||||
LOG_TEST_GOTO_ERR(ctx, r, "ASN.1 decoding failed");
|
LOG_TEST_GOTO_ERR(ctx, r, "ASN.1 decoding failed");
|
||||||
|
|
Loading…
Reference in New Issue