]> granicus.if.org Git - php/commitdiff
Fixed a memory leak inside load_all_certs_file()
authorIlia Alshanetsky <iliaa@php.net>
Tue, 19 Jun 2007 22:09:49 +0000 (22:09 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 19 Jun 2007 22:09:49 +0000 (22:09 +0000)
ext/openssl/openssl.c

index 10cf46291753b2349f806c80ea66e5474b682bc5..c6ee21dd6bebc2459e95509b733bcc66b0686cca 100644 (file)
@@ -1109,17 +1109,20 @@ static STACK_OF(X509) * load_all_certs_from_file(char *certfile)
        }
 
        if (php_openssl_safe_mode_chk(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;
        }