[libvirt] [PATCH] util: fix memory leak in virFirewallDInterfaceSetZone()

Laine Stump posted 1 patch 5 years, 2 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20190213160107.8501-1-laine@laine.org
src/util/virfirewalld.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[libvirt] [PATCH] util: fix memory leak in virFirewallDInterfaceSetZone()
Posted by Laine Stump 5 years, 2 months ago
commit 3bba4825 added the new function virFirewallDInterfaceSetZone()
which calledsends virDBUSCallMethod a DBusMessage** for the reply
message, but doesn't use the reply, and also doesn't free it. Since
this arg is allowed to be NULL, this patch simply sets it to NULL so
we don't have to deal with it.

Signed-off-by: Laine Stump <laine@laine.org>
---
 src/util/virfirewalld.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/util/virfirewalld.c b/src/util/virfirewalld.c
index 47bacdcf4a..f8965eea09 100644
--- a/src/util/virfirewalld.c
+++ b/src/util/virfirewalld.c
@@ -351,13 +351,12 @@ virFirewallDInterfaceSetZone(const char *iface,
                              const char *zone)
 {
     DBusConnection *sysbus = virDBusGetSystemBus();
-    DBusMessage *reply = NULL;
 
     if (!sysbus)
         return -1;
 
     return virDBusCallMethod(sysbus,
-                             &reply,
+                             NULL,
                              NULL,
                              VIR_FIREWALL_FIREWALLD_SERVICE,
                              "/org/fedoraproject/FirewallD1",
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] util: fix memory leak in virFirewallDInterfaceSetZone()
Posted by Andrea Bolognani 5 years, 2 months ago
On Wed, 2019-02-13 at 11:01 -0500, Laine Stump wrote:
> commit 3bba4825 added the new function virFirewallDInterfaceSetZone()
> which calledsends virDBUSCallMethod a DBusMessage** for the reply
> message, but doesn't use the reply, and also doesn't free it. Since
> this arg is allowed to be NULL, this patch simply sets it to NULL so
> we don't have to deal with it.
> 
> Signed-off-by: Laine Stump <laine@laine.org>
> ---
>  src/util/virfirewalld.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization

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