[libvirt] [PATCH] virSystemdGetMachineNameByPID: Initialize @reply

Michal Privoznik mprivozn at redhat.com
Fri Feb 5 16:24:30 UTC 2016


I've noticed that variable @reply is not initialized and if
something at the beginning of the function fails, e.g.
virDBusGetSystemBus(), the control jump straight to cleanup label
where dbus_message_unref() is then called over this uninitialized
variable.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---

Pushed under trivial rule.

 src/util/virsystemd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 37007aa..6677798 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -181,7 +181,7 @@ char *
 virSystemdGetMachineNameByPID(pid_t pid)
 {
     DBusConnection *conn;
-    DBusMessage *reply;
+    DBusMessage *reply = NULL;
     char *name = NULL, *object = NULL;
 
     if (virDBusIsServiceEnabled("org.freedesktop.machine1") < 0)
-- 
2.4.10




More information about the libvir-list mailing list