From 555567468a06c31c7d962c827edc8c2a7f5fc455 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 24 Jan 2020 13:12:11 +0100 Subject: Fix memory leaks in mysqlnd debug functionality --- ext/mysqlnd/mysqlnd_debug.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ext/mysqlnd/mysqlnd_debug.c') diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c index b76fd4a2e5..cb512e1e9e 100644 --- a/ext/mysqlnd/mysqlnd_debug.c +++ b/ext/mysqlnd/mysqlnd_debug.c @@ -699,6 +699,10 @@ MYSQLND_CLASS_METHODS_START(mysqlnd_debug) MYSQLND_CLASS_METHODS_END; +static void free_ptr(zval *zv) { + efree(Z_PTR_P(zv)); +} + /* {{{ mysqlnd_debug_init */ PHPAPI MYSQLND_DEBUG * mysqlnd_debug_init(const char * skip_functions[]) @@ -710,7 +714,7 @@ mysqlnd_debug_init(const char * skip_functions[]) zend_stack_init(&ret->call_stack, sizeof(char *)); zend_stack_init(&ret->call_time_stack, sizeof(uint64_t)); zend_hash_init(&ret->not_filtered_functions, 0, NULL, NULL, 0); - zend_hash_init(&ret->function_profiles, 0, NULL, NULL, 0); + zend_hash_init(&ret->function_profiles, 0, NULL, free_ptr, 0); ret->m = & mysqlnd_mysqlnd_debug_methods; ret->skip_functions = skip_functions; -- cgit v1.2.1