d71922
From 704cb78bdb0b5bbb8409d2795b82d3936aae6f2b Mon Sep 17 00:00:00 2001
d71922
Message-Id: <704cb78bdb0b5bbb8409d2795b82d3936aae6f2b@dist-git>
d71922
From: Michal Privoznik <mprivozn@redhat.com>
d71922
Date: Tue, 16 Feb 2016 11:55:10 +0100
d71922
Subject: [PATCH] virSystemdGetMachineNameByPID: Initialize @reply
d71922
d71922
https://bugzilla.redhat.com/show_bug.cgi?id=1308494
d71922
d71922
I've noticed that variable @reply is not initialized and if
d71922
something at the beginning of the function fails, e.g.
d71922
virDBusGetSystemBus(), the control jump straight to cleanup label
d71922
where dbus_message_unref() is then called over this uninitialized
d71922
variable.
d71922
d71922
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
d71922
(cherry picked from commit a3b168d01a6254a5972d4eda87d7cbc3d9cdb3ef)
d71922
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
d71922
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
d71922
---
d71922
 src/util/virsystemd.c | 2 +-
d71922
 1 file changed, 1 insertion(+), 1 deletion(-)
d71922
d71922
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
d71922
index 0f4e1f0..7bc5d55 100644
d71922
--- a/src/util/virsystemd.c
d71922
+++ b/src/util/virsystemd.c
d71922
@@ -181,7 +181,7 @@ char *
d71922
 virSystemdGetMachineNameByPID(pid_t pid)
d71922
 {
d71922
     DBusConnection *conn;
d71922
-    DBusMessage *reply;
d71922
+    DBusMessage *reply = NULL;
d71922
     char *name = NULL, *object = NULL;
d71922
 
d71922
     if (virDBusIsServiceEnabled("org.freedesktop.machine1") < 0)
d71922
-- 
d71922
2.7.2
d71922