[PATCH] Avoid segfault upon early libvirtd failure.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



One of today's leak-plugging patches introduced a bug.
Fortunately, it can strike only when libvirtd is about to
fail anyway.  The consequence is that instead of failing in
an orderly manner, it would probably segfault.

Sorry about that.  Here's the fix:

	Avoid segfault upon early libvirtd failure.
	* qemud/qemud.c (main): Don't call qemudCleanup on an
	uninitialized pointer.

By the way, even though this evoked a warning from gcc,
"make distcheck" passes.  Obviously, that means the distcheck
rule is inadequate.  I'll fix it so that it turns on -Werror
for the final build.

Signed-off-by: Jim Meyering <meyering@xxxxxxxxxx>
---
 qemud/qemud.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/qemud/qemud.c b/qemud/qemud.c
index 96fdf32..b6b82ed 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -2025,7 +2025,7 @@ libvirt management daemon:\n\

 #define MAX_LISTEN 5
 int main(int argc, char **argv) {
-    struct qemud_server *server;
+    struct qemud_server *server = NULL;
     struct sigaction sig_action;
     int sigpipe[2];
     const char *pid_file = NULL;
@@ -2180,7 +2180,8 @@ int main(int argc, char **argv) {
         unlink (pid_file);

  error1:
-    qemudCleanup(server);
+    if (server)
+        qemudCleanup(server);
     return ret;
 }

--
1.5.4.3.366.g55277

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]