From: Wez Furlong Date: Tue, 26 Oct 2004 09:29:22 +0000 (+0000) Subject: Fix for Bug #29418 (double free when openssl_csr_new fails). X-Git-Tag: php-4.3.10RC1~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8cb520a8558c0ef851feb7ea339d838a2a30bf14;p=php Fix for Bug #29418 (double free when openssl_csr_new fails). Also hook up MSHUTDOWN function which appears to have never been enabled. Patch by Kamesh Jayachandran --- diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index d2f5999b0f..b1a7c856a8 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -118,7 +118,7 @@ zend_module_entry openssl_module_entry = { "openssl", openssl_functions, PHP_MINIT(openssl), - NULL, + PHP_MSHUTDOWN(openssl), NULL, NULL, PHP_MINFO(openssl), @@ -1616,6 +1616,12 @@ PHP_FUNCTION(openssl_csr_new) req.priv_key = NULL; /* make sure the cleanup code doesn't zap it! */ } } + else { + if (!we_made_the_key) { + /* if we have not made the key we are not supposed to zap it by calling dispose! */ + req.priv_key = NULL; + } + } } } }