]> granicus.if.org Git - php/commitdiff
Revert "libmagic: Move the allocation on the stack"
authorAnatol Belski <ab@php.net>
Wed, 2 Sep 2020 18:04:00 +0000 (20:04 +0200)
committerAnatol Belski <ab@php.net>
Wed, 2 Sep 2020 18:04:00 +0000 (20:04 +0200)
This reverts commit 1d84a58736541b61fc9d569580715940e32d55c9.

Signed-off-by: Anatol Belski <ab@php.net>
ext/fileinfo/libmagic/softmagic.c

index ef60033bbce2e61f936d80752fadb333be3555d2..c7a386984bc79402d3430fbcc04eb7c0b8d6af44 100644 (file)
@@ -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;
 }