X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=fish%2Fdestpaths.c;h=8b6173aa6ce92849a3ab02b010a5b6aa1d4e500b;hb=da54ae6abbd840e28c294949bc796a231f050d6d;hp=f4f131881ee2d8aa6d9d7e30ded33cfb7b0f779d;hpb=2f1a50d81671810256dce0852e6b1e0810ac44af;p=libguestfs.git diff --git a/fish/destpaths.c b/fish/destpaths.c index f4f1318..8b6173a 100644 --- a/fish/destpaths.c +++ b/fish/destpaths.c @@ -113,7 +113,7 @@ complete_dest_paths_generator (const char *text, int state) size_t i; \ size_t n = count_strings (strs); \ \ - if ( ! xalloc_oversized (nr_words + n, sizeof (struct word))) { \ + if ( n > 0 && ! xalloc_oversized (nr_words + n, sizeof (struct word))) { \ struct word *w; \ w = realloc (words, sizeof (struct word) * (nr_words + n)); \ \ @@ -129,8 +129,8 @@ complete_dest_paths_generator (const char *text, int state) nr_words++; \ } \ } \ - free (strs); \ } \ + free (strs); \ } \ } while (0)