From: Anatol Belski Date: Wed, 2 Sep 2020 18:04:00 +0000 (+0200) Subject: Revert "libmagic: Move the allocation on the stack" X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2b40775af7165d0f343fe6351e0d468403c111b;p=php Revert "libmagic: Move the allocation on the stack" This reverts commit 1d84a58736541b61fc9d569580715940e32d55c9. Signed-off-by: Anatol Belski --- diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c index ef60033bbc..c7a386984b 100644 --- a/ext/fileinfo/libmagic/softmagic.c +++ b/ext/fileinfo/libmagic/softmagic.c @@ -479,12 +479,11 @@ check_fmt(struct magic_set *ms, const char *fmt) pcre_cache_entry *pce; int rv = -1; zend_string *pattern; - ALLOCA_FLAG(use_heap) if (strchr(fmt, '%') == NULL) return 0; - ZSTR_ALLOCA_INIT(pattern, "~%[-0-9\\.]*s~", sizeof("~%[-0-9\\.]*s~") - 1, use_heap); + pattern = zend_string_init("~%[-0-9\\.]*s~", sizeof("~%[-0-9\\.]*s~") - 1, 0); if ((pce = pcre_get_compiled_regex_cache_ex(pattern, 0)) == NULL) { rv = -1; } else { @@ -495,7 +494,7 @@ check_fmt(struct magic_set *ms, const char *fmt) php_pcre_free_match_data(match_data); } } - ZSTR_ALLOCA_FREE(pattern, use_heap); + zend_string_release(pattern); return rv; }