[PATCH] virSystemdGetMachineNameByPID: Initialize @reply

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

 



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@xxxxxxxxxx>
---

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

--
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]