mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Revert "libmagic: Move the allocation on the stack"
This reverts commit 1d84a58736
.
Signed-off-by: Anatol Belski <ab@php.net>
This commit is contained in:
parent
f3f5719355
commit
f2b40775af
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user