pkcs15-oberthur: Avoid memory leaks on failures

This commit is contained in:
Jakub Jelen 2018-09-27 15:13:25 +02:00 committed by Frank Morgner
parent a1dfdbbdbc
commit 52959df9f6
1 changed files with 3 additions and 1 deletions

View File

@ -206,8 +206,10 @@ sc_oberthur_get_certificate_authority(struct sc_pkcs15_der *der, int *out_author
buf_mem.max = buf_mem.length = der->len;
bio = BIO_new(BIO_s_mem());
if(!bio)
if (!bio) {
free(buf_mem.data);
return SC_ERROR_OUT_OF_MEMORY;
}
BIO_set_mem_buf(bio, &buf_mem, BIO_NOCLOSE);
x = d2i_X509_bio(bio, 0);