patch for trivial ZE2 leaks

[email protected] (Moriyoshi Koizumi) Sat, 08 Mar 2003 00:38:02 +0900
Newsgroups php.dev
Message-ID <[email protected]>
I found memleaks in the current HEAD. A Patch for this issue attached.

$ php -r "class foo {}"

/home/koizumi/src/php5/Zend/zend_hash.c(198) :  Freeing 0x400C1034 (64 bytes), s
cript=-
/home/koizumi/src/php5/Zend/zend_hash.c(176) : Actual location (location was rel
ayed)
Last leak repeated 5 times
/home/koizumi/src/php5/Zend/zend_compile.c(3454) :  Freeing 0x400C0ED4 (44 bytes
), script=-
/home/koizumi/src/php5/Zend/zend_compile.c(2201) :  Freeing 0x400C0CD0 (296 byte
s), script=-
/home/koizumi/src/php5/Zend/zend_language_scanner.l(1107) :  Freeing 0x400C0C94
(4 bytes), script=-
zend_compile.c.diff.txt (text/plain, 638 B)
Index: Zend/zend_compile.c
===================================================================
RCS file: /repository/ZendEngine2/zend_compile.c,v
retrieving revision 1.388
diff -u -r1.388 zend_compile.c
--- Zend/zend_compile.c	6 Mar 2003 23:45:50 -0000	1.388
+++ Zend/zend_compile.c	7 Mar 2003 15:29:42 -0000
@@ -2207,6 +2207,7 @@
 		zend_error(E_COMPILE_ERROR, "Cannot use '%s' as class name as it is reserved", class_name->u.constant.value.str.val);
 	}
 
+	new_class_entry->type = ZEND_USER_CLASS;
 	new_class_entry->name = class_name->u.constant.value.str.val;
 	new_class_entry->name_length = class_name->u.constant.value.str.len;