summaryrefslogtreecommitdiff
path: root/lib/readline/complete.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/readline/complete.c')
-rw-r--r--lib/readline/complete.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/readline/complete.c b/lib/readline/complete.c
index 7e6700a8..31f03f7b 100644
--- a/lib/readline/complete.c
+++ b/lib/readline/complete.c
@@ -2132,13 +2132,17 @@ rl_completion_matches (text, entry_function)
xfree (match_list);
match_list = 0;
match_list_size = 0;
+ matches = 0;
RL_CHECK_SIGNALS ();
}
- if (matches + 1 == match_list_size)
+ if (matches + 1 >= match_list_size)
match_list = (char **)xrealloc
(match_list, ((match_list_size += 10) + 1) * sizeof (char *));
+ if (match_list == 0)
+ return (match_list);
+
match_list[++matches] = string;
match_list[matches + 1] = (char *)NULL;
}