[Libosinfo] [PATCH 10/14] install-script: Fix leak in _template_loaded()

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


The file content obtained through g_file_load_contents_finish() was
never freed.

This fixes:
==29859== 16,384 bytes in 1 blocks are definitely lost in loss record 2,294 of 2,295
==29859==    at 0x4C2DC57: realloc (vg_replace_malloc.c:785)
==29859==    by 0x684FF1F: g_realloc (gmem.c:159)
==29859==    by 0x681DE68: g_array_maybe_expand (garray.c:779)
==29859==    by 0x681E783: g_array_set_size (garray.c:555)
==29859==    by 0x681F328: g_byte_array_set_size (garray.c:1752)
==29859==    by 0x626F143: load_contents_read_callback (gfile.c:6885)
==29859==    by 0x6289129: async_ready_callback_wrapper (ginputstream.c:532)
==29859==    by 0x62B0342: g_task_return_now (gtask.c:1107)
==29859==    by 0x62B0378: complete_in_idle_cb (gtask.c:1121)
==29859==    by 0x684A702: g_main_dispatch (gmain.c:3154)
==29859==    by 0x684A702: g_main_context_dispatch (gmain.c:3769)
==29859==    by 0x684AAAF: g_main_context_iterate.isra.29 (gmain.c:3840)
==29859==    by 0x684ADD1: g_main_loop_run (gmain.c:4034)
==29859==    by 0x402442: test_script_file (test-install-script.c:165)
==29859==    by 0x5117535: tcase_run_tfun_nofork.isra.9 (check_run.c:390)
==29859==    by 0x51178EB: srunner_iterate_tcase_tfuns (check_run.c:231)
==29859==    by 0x51178EB: srunner_run_tcase (check_run.c:373)
==29859==    by 0x51178EB: srunner_iterate_suites (check_run.c:195)
==29859==    by 0x51178EB: srunner_run (check_run.c:782)
==29859==    by 0x40303D: main (test-install-script.c:349)
---
 osinfo/osinfo_install_script.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index 23831c5..23db364 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -904,6 +904,7 @@ static void osinfo_install_script_template_loaded(GObject *src,
     g_task_return_pointer(data->res, output, NULL);
 
  cleanup:
+    g_free(input);
     osinfo_install_script_generate_data_free(data);
     g_free(uri);
 }
-- 
2.7.4




More information about the Libosinfo mailing list