From: Pierre Joye Date: Wed, 20 Jun 2007 05:27:38 +0000 (+0000) Subject: - MFB: Fixed a memory leak inside load_all_certs_file() X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~414 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a4c51e17a801f88fcae6693755963a5e590ff86;p=php - MFB: Fixed a memory leak inside load_all_certs_file() --- diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 61e7e0174e..eb32247ceb 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -1095,17 +1095,20 @@ static STACK_OF(X509) * load_all_certs_from_file(char *certfile) } if (php_check_open_basedir(certfile TSRMLS_CC)) { + sk_X509_free(stack); goto end; } if(!(in=BIO_new_file(certfile, "r"))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "error opening the file, %s", certfile); + sk_X509_free(stack); goto end; } /* This loads from a file, a stack of x509/crl/pkey sets */ if(!(sk=PEM_X509_INFO_read_bio(in, NULL, NULL, NULL))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "error reading the file, %s", certfile); + sk_X509_free(stack); goto end; }