g_variant_iter_loop() handles freeing all arguments unless we break out
of the loop, in that case we have to free them manually.
Reported-by: Peter Krempa <pkrempa(a)redhat.com>
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/util/virgdbus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/util/virgdbus.c b/src/util/virgdbus.c
index cd9ca8d5d6..4360a6acff 100644
--- a/src/util/virgdbus.c
+++ b/src/util/virgdbus.c
@@ -359,8 +359,10 @@ virGDBusIsServiceInList(const char *listMethod,
g_variant_get(reply, "(as)", &iter);
while (g_variant_iter_loop(iter, "s", &str)) {
- if (STREQ(str, name))
+ if (STREQ(str, name)) {
+ g_free(str);
return 0;
+ }
}
return -2;
--
2.26.2