]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Don't leak @reply in virSystemdGetMachineNameByPID
authorWang King <king.wang@huawei.com>
Sat, 20 May 2017 01:31:57 +0000 (09:31 +0800)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 22 May 2017 04:48:01 +0000 (06:48 +0200)
@reply is a DBusMessage object returned by virDBusCallMethod in
get machine object call path, dereference it before calling
virDBusCallMethod again to get machine name.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virsystemd.c

index 83737a2c6fd36ea909890dda3f8793282cf01032..5d9746f9955ff36edb390e249b95df7a27bc854d 100644 (file)
@@ -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);