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

Wang King posted 1 patch 6 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20170520013157.80696-1-king.wang@huawei.com
src/util/virsystemd.c | 3 +++
1 file changed, 3 insertions(+)
[libvirt] [PATCH] util: Don't leak @replay in virSystemdGetMachineNameByPID
Posted by Wang King 6 years, 11 months ago
@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


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] util: Don't leak @replay in virSystemdGetMachineNameByPID
Posted by Michal Privoznik 6 years, 11 months ago
On 05/20/2017 03:31 AM, Wang King wrote:
>

s/replay/reply/ in $SUBJ

> @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(+)
> 

ACKed and pushed.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list