oberthur: Fix memory leaks
Thanks oss-fuzz https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32149
This commit is contained in:
parent
d5dea2dd1b
commit
715c17c469
|
@ -211,6 +211,7 @@ sc_oberthur_get_certificate_authority(struct sc_pkcs15_der *der, int *out_author
|
||||||
|
|
||||||
BIO_set_mem_buf(bio, &buf_mem, BIO_NOCLOSE);
|
BIO_set_mem_buf(bio, &buf_mem, BIO_NOCLOSE);
|
||||||
x = d2i_X509_bio(bio, 0);
|
x = d2i_X509_bio(bio, 0);
|
||||||
|
free(buf_mem.data);
|
||||||
BIO_free(bio);
|
BIO_free(bio);
|
||||||
if (!x)
|
if (!x)
|
||||||
return SC_ERROR_INVALID_DATA;
|
return SC_ERROR_INVALID_DATA;
|
||||||
|
@ -729,7 +730,10 @@ sc_pkcs15emu_oberthur_add_cert(struct sc_pkcs15_card *p15card, unsigned int file
|
||||||
cinfo.value.len = cert_len;
|
cinfo.value.len = cert_len;
|
||||||
|
|
||||||
rv = sc_oberthur_get_certificate_authority(&cinfo.value, &cinfo.authority);
|
rv = sc_oberthur_get_certificate_authority(&cinfo.value, &cinfo.authority);
|
||||||
LOG_TEST_RET(ctx, rv, "Failed to add certificate: get certificate attributes error");
|
if (rv != SC_SUCCESS) {
|
||||||
|
free(cinfo.value.value);
|
||||||
|
LOG_TEST_RET(ctx, rv, "Failed to add certificate: get certificate attributes error");
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & OBERTHUR_ATTR_MODIFIABLE)
|
if (flags & OBERTHUR_ATTR_MODIFIABLE)
|
||||||
cobj.flags |= SC_PKCS15_CO_FLAG_MODIFIABLE;
|
cobj.flags |= SC_PKCS15_CO_FLAG_MODIFIABLE;
|
||||||
|
|
Loading…
Reference in New Issue