Richard W.M. Jones
2009-Aug-06 13:39 UTC
[Libguestfs] [PATCH] Fix for tab-completion segfault
https://bugzilla.redhat.com/show_bug.cgi?id=516024 Segfault in tab completion (sometimes). This patch fixes it. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top -------------- next part -------------->From 7a0363897d77ef472f7a58c7d1de34dfceea85c0 Mon Sep 17 00:00:00 2001From: Richard Jones <rjones at trick.home.annexia.org> Date: Thu, 6 Aug 2009 14:35:46 +0100 Subject: [PATCH] Fix: segfault in tab completion (RHBZ#516024). Actually this fixes two bugs: 'strs' was not being freed on every path, and the tab completion segfault described in the bug report. --- fish/destpaths.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) 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) -- 1.6.2.5
Seemingly Similar Threads
- [PATCH 0/2] Add RELAX NG schema and tests for virt-inspector --xml
- [PATCH / discussion only] Lib.pm: Add file_architecture command.
- [PATCH v2] Replace shell_quote function with %Q and %R printf specifiers.
- ANNOUNCE: libguestfs 1.0.64 released
- [PATCH] Allow selinux=? and enforcing=? kernel flags to be controlled