From 369ebd72005a90202ddc0245766b709f8a6db28e Mon Sep 17 00:00:00 2001 From: Mikhail Galanin Date: Fri, 9 Dec 2022 14:21:06 +0000 Subject: [PATCH] Nullify references once not used to prevent double-frees --- extension/xhprof.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extension/xhprof.c b/extension/xhprof.c index 9eecf70d..f88c1e8d 100755 --- a/extension/xhprof.c +++ b/extension/xhprof.c @@ -526,6 +526,7 @@ void hp_clean_profiler_state() if (XHPROF_G(root)) { zend_string_release(XHPROF_G(root)); + XHPROF_G(root) = NULL; } /* Delete the array storing ignored function names */ @@ -1246,6 +1247,7 @@ static void hp_stop() if (XHPROF_G(root)) { zend_string_release(XHPROF_G(root)); + XHPROF_G(root) = NULL; } } @@ -1263,6 +1265,7 @@ static inline void hp_array_del(zend_string **names) int i = 0; for (; names[i] != NULL && i < XHPROF_MAX_IGNORED_FUNCTIONS; i++) { zend_string_release(names[i]); + names[i] = NULL; } efree(names);