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

[libvirt] [PATCH] util: Don't leak @replay in virSystemdGetMachineNameByPID



@reply is a DBusMessage object returned by virDBusCallMethod in
get machine object call path, dereference it before calling
virDBusCallMethod again to get machine name.
---
 src/util/virsystemd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 83737a2..5d9746f 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -247,6 +247,9 @@ virSystemdGetMachineNameByPID(pid_t pid)
     if (virDBusMessageRead(reply, "o", &object) < 0)
         goto cleanup;
 
+    virDBusMessageUnref(reply);
+    reply = NULL;
+
     VIR_DEBUG("Domain with pid %lld has object path '%s'",
               (long long) pid, object);
 
-- 
2.8.3



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