]> granicus.if.org Git - php/commitdiff
Patch by Marcus Börger to fix some memleaks
authorSterling Hughes <sterling@php.net>
Fri, 18 Apr 2003 18:40:53 +0000 (18:40 +0000)
committerSterling Hughes <sterling@php.net>
Fri, 18 Apr 2003 18:40:53 +0000 (18:40 +0000)
Zend/zend.c
Zend/zend_opcode.c

index beb38d1a0146cea000aab3d39537cc2959139be6..488aa3fa7acbbc1ed18e89c307856a5fb3178544 100644 (file)
@@ -382,6 +382,10 @@ static void register_standard_class(TSRMLS_D)
        zend_hash_add(GLOBAL_CLASS_TABLE, "stdclass", sizeof("stdclass"), &zend_standard_class_def, sizeof(zend_class_entry *), NULL);
 }
 
+static void unregister_standard_class()
+{
+       destroy_zend_class(&zend_standard_class_def);
+}
 
 static void zend_set_default_compile_time_values(TSRMLS_D)
 {
@@ -657,17 +661,19 @@ void zend_shutdown(TSRMLS_D)
        zend_hash_graceful_reverse_destroy(&module_registry);
        zend_destroy_rsrc_list_dtors();
 
-#ifndef ZTS
-       /* In ZTS mode these are freed by compiler_globals_dtor() */
        zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
        zend_hash_destroy(GLOBAL_CLASS_TABLE);
-#endif
 
        zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE);
        free(GLOBAL_AUTO_GLOBALS_TABLE);
        zend_shutdown_extensions(TSRMLS_C);
        free(zend_version_info);
+
        zend_shutdown_constants(TSRMLS_C);
+#ifdef ZTS
+       zend_hash_destroy(GLOBAL_CONSTANTS_TABLE);
+#endif
+       unregister_standard_class();
 }
 
 
index 302a715ff2180be3a92e1bdd505aacb837db71c4..af9ff1450e95c2ed209ffe66b7680200e186a9f0 100644 (file)
@@ -173,6 +173,12 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
                        free(ce->static_members);
                        zend_hash_destroy(&ce->constants_table);
                        zend_hash_destroy(&ce->class_table);
+                       if (ce->num_interfaces > 0) {
+                               free(ce->interfaces);
+                       }
+                       if (ce->doc_comment) {
+                               free(ce->doc_comment);
+                       }
                        free(ce);
                        break;
                case ZEND_USER_NAMESPACE: