]> granicus.if.org Git - php/commitdiff
Fix for Bug #29418 (double free when openssl_csr_new fails).
authorWez Furlong <wez@php.net>
Tue, 26 Oct 2004 09:29:22 +0000 (09:29 +0000)
committerWez Furlong <wez@php.net>
Tue, 26 Oct 2004 09:29:22 +0000 (09:29 +0000)
Also hook up MSHUTDOWN function which appears to have never been enabled.

Patch by Kamesh Jayachandran

ext/openssl/openssl.c

index d2f5999b0f40c18bc41cc6a0328e2a5564f500e1..b1a7c856a8d52f656259f4803cbecda33093e65f 100644 (file)
@@ -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;
+                                       }
+                               }
                        }
                }
        }