pkcs15-cert: Avoid memory leaks

Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24056
This commit is contained in:
Jakub Jelen 2020-09-01 17:19:25 +02:00 committed by Jakub Jelen
parent 777a9e0386
commit 460a862ee0
1 changed files with 2 additions and 1 deletions

View File

@ -108,7 +108,6 @@ parse_x509_cert(sc_context_t *ctx, struct sc_pkcs15_der *der, struct sc_pkcs15_c
if (!pubkey)
LOG_TEST_GOTO_ERR(ctx, SC_ERROR_INVALID_ASN1_OBJECT, "Unable to decode subjectPublicKeyInfo from cert");
sc_asn1_clear_algorithm_id(&sig_alg);
if (serial && serial_len) {
sc_format_asn1_entry(asn1_serial_number + 0, serial, &serial_len, 1);
@ -129,6 +128,8 @@ parse_x509_cert(sc_context_t *ctx, struct sc_pkcs15_der *der, struct sc_pkcs15_c
}
err:
/* not used for anything */
sc_asn1_clear_algorithm_id(&sig_alg);
free(serial);
free(subject);
free(issuer);