@@ -1262,6 +1262,15 @@ static void cls_method_dtor(zval *el) /* {{{ */ {
1262
1262
}
1263
1263
/* }}} */
1264
1264
1265
+ static void cls_method_pdtor (zval * el ) /* {{{ */ {
1266
+ zend_function * func = (zend_function * )Z_PTR_P (el );
1267
+ if (func -> common .function_name ) {
1268
+ zend_string_release (func -> common .function_name );
1269
+ }
1270
+ pefree (func , 1 );
1271
+ }
1272
+ /* }}} */
1273
+
1265
1274
/* {{{ overloaded object handlers for PDO class */
1266
1275
int pdo_hash_methods (pdo_dbh_object_t * dbh_obj , int kind )
1267
1276
{
@@ -1283,12 +1292,13 @@ int pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind)
1283
1292
if (!(dbh -> cls_methods [kind ] = pemalloc (sizeof (HashTable ), dbh -> is_persistent ))) {
1284
1293
php_error_docref (NULL , E_ERROR , "out of memory while allocating PDO methods." );
1285
1294
}
1286
- zend_hash_init_ex (dbh -> cls_methods [kind ], 8 , NULL , cls_method_dtor , dbh -> is_persistent , 0 );
1295
+ zend_hash_init_ex (dbh -> cls_methods [kind ], 8 , NULL ,
1296
+ dbh -> is_persistent ? cls_method_pdtor : cls_method_dtor , dbh -> is_persistent , 0 );
1287
1297
1288
1298
while (funcs -> fname ) {
1289
1299
ifunc -> type = ZEND_INTERNAL_FUNCTION ;
1290
1300
ifunc -> handler = funcs -> handler ;
1291
- ifunc -> function_name = zend_string_init (funcs -> fname , strlen (funcs -> fname ), 0 );
1301
+ ifunc -> function_name = zend_string_init (funcs -> fname , strlen (funcs -> fname ), dbh -> is_persistent );
1292
1302
ifunc -> scope = dbh_obj -> std .ce ;
1293
1303
ifunc -> prototype = NULL ;
1294
1304
if (funcs -> flags ) {
0 commit comments