[PATCH 03/14] test: Fix osinfo_list_get_elements() leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The returned list must be freed after use.

This fixes:

==13583==    at 0x4C2BBAD: malloc (vg_replace_malloc.c:299)
==13583==    by 0x684FE58: g_malloc (gmem.c:94)
==13583==    by 0x6866D42: g_slice_alloc (gslice.c:1025)
==13583==    by 0x68462B5: g_list_prepend (glist.c:311)
==13583==    by 0x683A06B: g_hash_table_get_values (ghash.c:1814)
==13583==    by 0x532D2CC: osinfo_list_get_elements (osinfo_list.c:212)
==13583==    by 0x401961: test_uris (test-mediauris.c:87)
==13583==    by 0x5117535: tcase_run_tfun_nofork.isra.9 (check_run.c:390)
==13583==    by 0x51178EB: srunner_iterate_tcase_tfuns (check_run.c:231)
==13583==    by 0x51178EB: srunner_run_tcase (check_run.c:373)
==13583==    by 0x51178EB: srunner_iterate_suites (check_run.c:195)
==13583==    by 0x51178EB: srunner_run (check_run.c:782)
==13583==    by 0x4016A4: main (test-mediauris.c:146)
---
 test/test-mediauris.c | 2 +-
 test/test-treeuris.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/test-mediauris.c b/test/test-mediauris.c
index ce7841c..46a68f0 100644
--- a/test/test-mediauris.c
+++ b/test/test-mediauris.c
@@ -97,7 +97,7 @@ START_TEST(test_uris)
         tmp = tmp->next;
     }
 
-    g_list_free(tmp);
+    g_list_free(osel);
     if (oslist)
         g_object_unref(oslist);
 
diff --git a/test/test-treeuris.c b/test/test-treeuris.c
index 3fe8b77..b5c50c6 100644
--- a/test/test-treeuris.c
+++ b/test/test-treeuris.c
@@ -97,7 +97,7 @@ START_TEST(test_uris)
         tmp = tmp->next;
     }
 
-    g_list_free(tmp);
+    g_list_free(osel);
     if (oslist)
         g_object_unref(oslist);
 
-- 
2.7.4

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux