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

Fix memory leak when calloc() fails in php_readline_completion_cb()

Closes GH-18637.
This commit is contained in:
Niels Dossche
2025-05-24 16:17:43 +02:00
parent d6836fb345
commit c9781111e1
2 changed files with 6 additions and 1 deletions

4
NEWS
View File

@@ -8,6 +8,10 @@ PHP NEWS
- Phar:
. Add missing filter cleanups on phar failure. (nielsdos)
- Readline:
. Fix memory leak when calloc() fails in php_readline_completion_cb().
(nielsdos)
05 Jun 2025, PHP 8.3.22
- Core:

View File

@@ -458,13 +458,14 @@ char **php_readline_completion_cb(const char *text, int start, int end)
/* libedit will read matches[2] */
matches = calloc(3, sizeof(char *));
if (!matches) {
return NULL;
goto out;
}
matches[0] = strdup("");
}
}
}
out:
zval_ptr_dtor(&params[0]);
zval_ptr_dtor(&_readline_array);