]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - lib/readline/complete.c
bash-4.3-beta overlay
[thirdparty/bash.git] / lib / readline / complete.c
index 7e6700a827492a8bcdad64f4043d2f7ede42a49d..31f03f7bdefbf387c81846a68fc7718c01d2f711 100644 (file)
@@ -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;
     }