1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Use APPLY_STOP in pcre_clean_cache() (GH-15839)

Once num_clean has reached 0, we never remove any more elements anyway.

Closes GH-15839
This commit is contained in:
Ilija Tovilo
2024-09-12 22:32:23 +02:00
committed by GitHub
parent 1facbc385a
commit ffb440550c

View File

@@ -494,8 +494,10 @@ static int pcre_clean_cache(zval *data, void *arg)
pcre_cache_entry *pce = (pcre_cache_entry *) Z_PTR_P(data);
int *num_clean = (int *)arg;
if (*num_clean > 0 && !pce->refcount) {
(*num_clean)--;
if (!pce->refcount) {
if (--(*num_clean) == 0) {
return ZEND_HASH_APPLY_REMOVE|ZEND_HASH_APPLY_STOP;
}
return ZEND_HASH_APPLY_REMOVE;
} else {
return ZEND_HASH_APPLY_KEEP;