]> granicus.if.org Git - php/commitdiff
Free cert in php_openssl_load_stream_cafile()
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 21 Jun 2019 12:03:06 +0000 (14:03 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 21 Jun 2019 13:07:00 +0000 (15:07 +0200)
X509_STORE_add_cert() increments the refcount of the cert, so we
should free it here.

ext/openssl/xp_ssl.c

index a423da6e741dc88d3558486a4d8d91bc956835e6..c8e5692bbe0e1fa6d89e8d1bdc92ab57523167ba 100644 (file)
@@ -827,6 +827,7 @@ static long php_openssl_load_stream_cafile(X509_STORE *cert_store, const char *c
                buffer_active = 0;
                if (cert && X509_STORE_add_cert(cert_store, cert)) {
                        ++certs_added;
+                       X509_free(cert);
                }
                goto cert_start;
        }