diff --git a/NEWS b/NEWS index ca7c8bdb40a..2eb0a9c807f 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,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) + - SimpleXML: . Fixed bug GH-18597 (Heap-buffer-overflow in zend_alloc.c when assigning string with UTF-8 bytes). (nielsdos) diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 30f84d61002..d2929218569 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -473,13 +473,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);