Skip to content

Commit 5555674

Browse files
committed
Fix memory leaks in mysqlnd debug functionality
1 parent 1ea5d2e commit 5555674

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ext/mysqlnd/mysqlnd_debug.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,10 @@ MYSQLND_CLASS_METHODS_START(mysqlnd_debug)
699699
MYSQLND_CLASS_METHODS_END;
700700

701701

702+
static void free_ptr(zval *zv) {
703+
efree(Z_PTR_P(zv));
704+
}
705+
702706
/* {{{ mysqlnd_debug_init */
703707
PHPAPI MYSQLND_DEBUG *
704708
mysqlnd_debug_init(const char * skip_functions[])
@@ -710,7 +714,7 @@ mysqlnd_debug_init(const char * skip_functions[])
710714
zend_stack_init(&ret->call_stack, sizeof(char *));
711715
zend_stack_init(&ret->call_time_stack, sizeof(uint64_t));
712716
zend_hash_init(&ret->not_filtered_functions, 0, NULL, NULL, 0);
713-
zend_hash_init(&ret->function_profiles, 0, NULL, NULL, 0);
717+
zend_hash_init(&ret->function_profiles, 0, NULL, free_ptr, 0);
714718

715719
ret->m = & mysqlnd_mysqlnd_debug_methods;
716720
ret->skip_functions = skip_functions;

0 commit comments

Comments
 (0)