summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2011-07-28 10:42:45 +0000
committerPierre Joye <pajoye@php.net>2011-07-28 10:42:45 +0000
commitd3fd31b6dd36fdad393dcc74fca2d9005b79cd84 (patch)
tree4e0a60215e923579b8e3f347a04dc2358f603833 /ext
parent7ec6d3ae47b44b74712a87420062c6935f48450d (diff)
downloadphp-git-d3fd31b6dd36fdad393dcc74fca2d9005b79cd84.tar.gz
- Fix #55301 (readline part) check if malloc succeded
Diffstat (limited to 'ext')
-rw-r--r--ext/readline/readline.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index cf80e0cd7b..f57f375412 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -465,6 +465,9 @@ static char **_readline_completion_cb(const char *text, int start, int end)
matches = rl_completion_matches(text,_readline_command_generator);
} else {
matches = malloc(sizeof(char *) * 2);
+ if (!matches) {
+ return NULL;
+ }
matches[0] = strdup("");
matches[1] = '\0';
}
@@ -505,7 +508,10 @@ PHP_FUNCTION(readline_completion_function)
zval_copy_ctor(_readline_completion);
rl_attempted_completion_function = _readline_completion_cb;
-
+ if (rl_attempted_completion_function == NULL) {
+ efree(name);
+ RETURN_FALSE;
+ }
RETURN_TRUE;
}