From 996c461460b331557bc47a310a09a2337469745a Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 10 May 2026 12:56:19 +0200 Subject: Fix a memory leak --- src/sp_utils.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/sp_utils.c b/src/sp_utils.c index e6efcc6..10beb8b 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c @@ -393,11 +393,12 @@ bool sp_match_array_key(const zval* zv, const zend_string* to_match, const sp_re char* idx_str = NULL; spprintf(&idx_str, 0, ZEND_ULONG_FMT, idx); zend_string* tmp = zend_string_init(idx_str, strlen(idx_str), 0); - if (sp_match_value(tmp, to_match, rx)) { - efree(idx_str); + bool match = sp_match_value(tmp, to_match, rx); + zend_string_release(tmp); + efree(idx_str); + if (match) { return true; } - efree(idx_str); } } ZEND_HASH_FOREACH_END(); -- cgit v1.3