From 249ac33e36753daaeda7973a0d3cc7cb1f72948a Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 28 Sep 2011 02:57:27 +0200 Subject: free bio after using it --- src/lockdown.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lockdown.c b/src/lockdown.c index f22fb08..6f55991 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -1205,9 +1205,11 @@ lockdownd_error_t lockdownd_gen_pair_cert(key_data_t public_key, key_data_t * od if (USERPREF_E_SUCCESS == uret) { /* copy buffer for output */ membp = BIO_new(BIO_s_mem()); - if (PEM_write_bio_X509(membp, dev_cert) > 0) { + if (membp && PEM_write_bio_X509(membp, dev_cert) > 0) { odevice_cert->size = BIO_get_mem_data(membp, &odevice_cert->data); } + if (membp) + free(membp); ohost_cert->data = malloc(pem_host_cert.size); memcpy(ohost_cert->data, pem_host_cert.data, pem_host_cert.size); -- cgit v1.1-32-gdbae