]> granicus.if.org Git - php/commitdiff
Fixed bug #26042 (memory leak if mcrypt_generic_deinit() is not called
authorIlia Alshanetsky <iliaa@php.net>
Fri, 31 Oct 2003 04:33:51 +0000 (04:33 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 31 Oct 2003 04:33:51 +0000 (04:33 +0000)
after every mcrypt_generic_init() call).

# This will be MFHed into 4.3.X tree after release.

ext/mcrypt/mcrypt.c

index acd3a2e865a466863832f011b48ed143d12b0ce3..fecedf3bb14ea925813295f55e9390783c10c778 100644 (file)
@@ -223,6 +223,7 @@ PHP_INI_END()
 static void php_mcrypt_module_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
 {
        MCRYPT td = (MCRYPT) rsrc->ptr;
+       mcrypt_generic_deinit(td);
        mcrypt_module_close (td);
 }
 
@@ -426,6 +427,7 @@ PHP_FUNCTION(mcrypt_generic_init)
        }
        memcpy(iv_s, Z_STRVAL_PP(iv), iv_size);
 
+       mcrypt_generic_deinit(td);
        result = mcrypt_generic_init(td, key_s, key_size, iv_s);
 
        /* If this function fails, close the mcrypt module to prevent crashes