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:
4
NEWS
4
NEWS
@@ -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:
|
||||
|
||||
@@ -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(¶ms[0]);
|
||||
zval_ptr_dtor(&_readline_array);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user