[Libosinfo] [libosinfo] loader: Fix leak in osinfo_loader_find_files()

Christophe Fergeau cfergeau at redhat.com
Tue Apr 10 10:23:12 UTC 2018


'tmp' is used to iterate over the list of files, so it will be NULL at
the end of the iteration, and g_list_free() will be a no-op.
The initial list is stored in 'children', so free that instead.

Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
 osinfo/osinfo_loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index b2635dfb..cc5c20f5 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -2060,7 +2060,7 @@ static void osinfo_loader_find_files(OsinfoLoader *loader,
             tmp = tmp->next;
         }
         g_object_unref(ents);
-        g_list_free(tmp);
+        g_list_free(children);
     } else {
         OSINFO_ERROR(&error, "Unexpected file type");
         g_propagate_error(err, error);
-- 
2.14.3




More information about the Libosinfo mailing list