[Libosinfo] [PATCH 01/14] test-entity: Fix osinfo_entity_get_param_keys() leak

Christophe Fergeau cfergeau at redhat.com
Wed Jun 8 10:01:05 UTC 2016


The list returned by osinfo_entity_get_param_keys() must be freed.

==20812== 24 bytes in 1 blocks are definitely lost in loss record 109 of 262
==20812==    at 0x4C2BBAD: malloc (vg_replace_malloc.c:299)
==20812==    by 0x684FE58: g_malloc (gmem.c:94)
==20812==    by 0x6866D42: g_slice_alloc (gslice.c:1025)
==20812==    by 0x6846A13: g_list_append (glist.c:261)
==20812==    by 0x532BB88: osinfo_entity_get_param_keys (osinfo_entity.c:300)
==20812==    by 0x40160F: test_empty_props (test-entity.c:71)
==20812==    by 0x5117535: tcase_run_tfun_nofork.isra.9 (check_run.c:390)
==20812==    by 0x51178EB: srunner_iterate_tcase_tfuns (check_run.c:231)
==20812==    by 0x51178EB: srunner_run_tcase (check_run.c:373)
==20812==    by 0x51178EB: srunner_iterate_suites (check_run.c:195)
==20812==    by 0x51178EB: srunner_run (check_run.c:782)
==20812==    by 0x40314A: main (test-entity.c:344)
---
 test/test-entity.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/test-entity.c b/test/test-entity.c
index 68ecd95..15da5ff 100644
--- a/test/test-entity.c
+++ b/test/test-entity.c
@@ -71,6 +71,7 @@ START_TEST(test_empty_props)
     GList *keys = osinfo_entity_get_param_keys(ent);
     fail_unless(keys != NULL, "Entity param key list was not empty");
     fail_unless(keys->next == NULL, "Entity param key list was not empty");
+    g_list_free(keys);
 
     const gchar *value = osinfo_entity_get_param_value(ent, "wibble");
     fail_unless(value == NULL, "Entity param value was not NULL");
-- 
2.7.4




More information about the Libosinfo mailing list