[PATCH] Memory leak reported by ccmalloc
| From: | Vesselin Atanasov | Date: | Mon, 25 Aug 2003 07:10:09 +0000 |
| Subject: | [PATCH] Memory leak reported by ccmalloc | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-4163@lists.php.net to get a copy of this message | ||
Hello.
I compiled PHP with ccmalloc (a memory leak detector) and it reported two memory leaks.
Here is a patch that meakes the leak reports go away. Actually only the first two
allocations (GLOBAL_FUNCTION_TABLE and GLOBAL_CLASS_TABLE) are reported by ccmalloc,
but I think that GLOBAL_CONSTANTS_TABLE is missing too.
vesselin
diff -ruN php5-200308250130.orig/Zend/zend.c php5-200308250130/Zend/zend.c
--- php5-200308250130.orig/Zend/zend.c 2003-08-24 14:07:14.000000000 +0000
+++ php5-200308250130/Zend/zend.c 2003-08-25 08:13:52.000000000 +0000
@@ -685,7 +685,9 @@
zend_destroy_rsrc_list_dtors();
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
+ free(GLOBAL_FUNCTION_TABLE);
zend_hash_destroy(GLOBAL_CLASS_TABLE);
+ free(GLOBAL_CLASS_TABLE);
zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE);
free(GLOBAL_AUTO_GLOBALS_TABLE);
@@ -695,6 +697,7 @@
zend_shutdown_constants(TSRMLS_C);
#ifdef ZTS
zend_hash_destroy(GLOBAL_CONSTANTS_TABLE);
+ free(GLOBAL_CONSTANTS_TABLE);
unregister_standard_class();
#endif
}