From d92fc5b365f0743158375d036c38288343ca72f0 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 29 Apr 2026 23:16:23 +0200 Subject: Fix a memleak --- 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..f861fb9 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 matched = sp_match_value(tmp, to_match, rx); + zend_string_release(tmp); + efree(idx_str); + if (matched) { return true; } - efree(idx_str); } } ZEND_HASH_FOREACH_END(); -- cgit v1.3