[PATCH 3/5] virfirewalltest: Don't duplicate string when adding it onto stringlist

Michal Privoznik mprivozn at redhat.com
Fri Oct 2 09:22:08 UTC 2020


In our wrapper of g_dbus_connection_call_sync() in
virfirewalltest a string is duplicated and added onto a
virStringList. This leads to a memory leak because
virStringListAdd() duplicates the string itself.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tests/virfirewalltest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/virfirewalltest.c b/tests/virfirewalltest.c
index 607638e9d0..eed7bcbe50 100644
--- a/tests/virfirewalltest.c
+++ b/tests/virfirewalltest.c
@@ -119,7 +119,7 @@ VIR_MOCK_WRAP_RET_ARGS(g_dbus_connection_call_sync,
                 doError = true;
             }
 
-            virStringListAdd(&args, g_strdup(item));
+            virStringListAdd(&args, item);
         }
 
         if (fwBuf) {
-- 
2.26.2




More information about the libvir-list mailing list