mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
util/virgdbus: fix memory leak in virGDBusIsServiceInList
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@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
d6ac9b22d3
commit
784f204e7e
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user