summaryrefslogtreecommitdiff
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
commit618b480d910a837c61ab554e77af45f66a8a770a (patch)
tree1f105db5570d12c216d538e74af64a932d3be24f
parentbc165d3a65222c1a7d01f52390a6ce330f9298ea (diff)
downloadphp-git-618b480d910a837c61ab554e77af45f66a8a770a.tar.gz
- Fix #55301 (readline part) check if malloc succeded
-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 a5d0f7d2ba..e9cdacb275 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -478,6 +478,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';
}
@@ -518,7 +521,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;
}