[PATCH 1/7] util: Fix memory leak in virNetDevOpenvswitchInterfaceGetMaster

John Ferlan posted 7 patches 5 years, 2 months ago
[PATCH 1/7] util: Fix memory leak in virNetDevOpenvswitchInterfaceGetMaster
Posted by John Ferlan 5 years, 2 months ago
Since 032548c4 @cmd was never autofree'd. Perhaps as a result of
VIR_AUTOPTR type changes occurring at roughly the same time so the
copy pasta missed this.

Found by Coverity.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/util/virnetdevopenvswitch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index 7452527f49..d380b0cf22 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -428,7 +428,7 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname,
 int
 virNetDevOpenvswitchInterfaceGetMaster(const char *ifname, char **master)
 {
-    virCommandPtr cmd = virNetDevOpenvswitchCreateCmd();
+    g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd();
     int exitstatus;
 
     *master = NULL;
-- 
2.28.0

Re: [PATCH 1/7] util: Fix memory leak in virNetDevOpenvswitchInterfaceGetMaster
Posted by Ján Tomko 5 years, 2 months ago
On a Wednesday in 2020, John Ferlan wrote:
>Since 032548c4 @cmd was never autofree'd. Perhaps as a result of
>VIR_AUTOPTR type changes occurring at roughly the same time so the
>copy pasta missed this.
>
>Found by Coverity.
>
>Signed-off-by: John Ferlan <jferlan@redhat.com>
>---
> src/util/virnetdevopenvswitch.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano