Skip to content

Commit 72127ff

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix memory leak when calloc() fails in php_readline_completion_cb()
2 parents 64d511e + c978111 commit 72127ff

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ PHP NEWS
1212
- Phar:
1313
. Add missing filter cleanups on phar failure. (nielsdos)
1414

15+
- Readline:
16+
. Fix memory leak when calloc() fails in php_readline_completion_cb().
17+
(nielsdos)
18+
1519
- SimpleXML:
1620
. Fixed bug GH-18597 (Heap-buffer-overflow in zend_alloc.c when assigning
1721
string with UTF-8 bytes). (nielsdos)

ext/readline/readline.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,13 +473,14 @@ char **php_readline_completion_cb(const char *text, int start, int end)
473473
/* libedit will read matches[2] */
474474
matches = calloc(3, sizeof(char *));
475475
if (!matches) {
476-
return NULL;
476+
goto out;
477477
}
478478
matches[0] = strdup("");
479479
}
480480
}
481481
}
482482

483+
out:
483484
zval_ptr_dtor(&params[0]);
484485
zval_ptr_dtor(&_readline_array);
485486

0 commit comments

Comments
 (0)