]> xenbits.xensource.com Git - libvirt.git/commitdiff
virSystemdGetMachineNameByPID: Initialize @reply
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 5 Feb 2016 16:17:45 +0000 (17:17 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 5 Feb 2016 16:17:45 +0000 (17:17 +0100)
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@redhat.com>
src/util/virsystemd.c

index 37007aa915ecbb6766fce57aad461ee138cda3a3..667779809920617d41f3b5ba9998c648820b8c34 100644 (file)
@@ -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)