[PATCH 08/14] install-script: Fix GFile leaks

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

 



This fixes:

==12193== 89 (32 direct, 57 indirect) bytes in 1 blocks are definitely lost in loss record 1,826 of 2,310
==12193==    at 0x4C2BBAD: malloc (vg_replace_malloc.c:299)
==12193==    by 0x684FE58: g_malloc (gmem.c:94)
==12193==    by 0x6866D42: g_slice_alloc (gslice.c:1025)
==12193==    by 0x686736D: g_slice_alloc0 (gslice.c:1051)
==12193==    by 0x65E1821: g_type_create_instance (gtype.c:1857)
==12193==    by 0x65C36AA: g_object_new_internal (gobject.c:1781)
==12193==    by 0x65C50CC: g_object_newv (gobject.c:1928)
==12193==    by 0x65C58B3: g_object_new (gobject.c:1621)
==12193==    by 0x6320EF9: _g_local_file_new (glocalfile.c:301)
==12193==    by 0x98512F7: g_daemon_vfs_get_file_for_path (gdaemonvfs.c:383)
==12193==    by 0x98513A1: g_daemon_vfs_get_file_for_uri (gdaemonvfs.c:407)
==12193==    by 0x5334B09: osinfo_install_script_generate_async_common (osinfo_install_script.c:959)
==12193==    by 0x5335170: osinfo_install_script_generate_for_media_async (osinfo_install_script.c:1216)
==12193==    by 0x402B8A: test_script_file (test-install-script.c:157)
==12193==    by 0x5117535: tcase_run_tfun_nofork.isra.9 (check_run.c:390)
==12193==    by 0x51178EB: srunner_iterate_tcase_tfuns (check_run.c:231)
==12193==    by 0x51178EB: srunner_run_tcase (check_run.c:373)
==12193==    by 0x51178EB: srunner_iterate_suites (check_run.c:195)
==12193==    by 0x51178EB: srunner_run (check_run.c:782)
==12193==    by 0x401F82: main (test-install-script.c:345)

==12193== 89 (32 direct, 57 indirect) bytes in 1 blocks are definitely lost in loss record 1,827 of 2,310
==12193==    at 0x4C2BBAD: malloc (vg_replace_malloc.c:299)
==12193==    by 0x684FE58: g_malloc (gmem.c:94)
==12193==    by 0x6866D42: g_slice_alloc (gslice.c:1025)
==12193==    by 0x686736D: g_slice_alloc0 (gslice.c:1051)
==12193==    by 0x65E1821: g_type_create_instance (gtype.c:1857)
==12193==    by 0x65C36AA: g_object_new_internal (gobject.c:1781)
==12193==    by 0x65C50CC: g_object_newv (gobject.c:1928)
==12193==    by 0x65C58B3: g_object_new (gobject.c:1621)
==12193==    by 0x6320EF9: _g_local_file_new (glocalfile.c:301)
==12193==    by 0x98512F7: g_daemon_vfs_get_file_for_path (gdaemonvfs.c:383)
==12193==    by 0x98513A1: g_daemon_vfs_get_file_for_uri (gdaemonvfs.c:407)
==12193==    by 0x402899: test_script_data (test-install-script.c:191)
==12193==    by 0x5117535: tcase_run_tfun_nofork.isra.9 (check_run.c:390)
==12193==    by 0x51178EB: srunner_iterate_tcase_tfuns (check_run.c:231)
==12193==    by 0x51178EB: srunner_run_tcase (check_run.c:373)
==12193==    by 0x51178EB: srunner_iterate_suites (check_run.c:195)
==12193==    by 0x51178EB: srunner_run (check_run.c:782)
==12193==    by 0x401F82: main (test-install-script.c:345)
=
---
 osinfo/osinfo_install_script.c | 1 +
 test/test-install-script.c     | 1 +
 2 files changed, 2 insertions(+)

diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index 7f0d863..a290d2a 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -962,6 +962,7 @@ static void osinfo_install_script_generate_async_common(OsinfoInstallScript *scr
                                    cancellable,
                                    osinfo_install_script_template_loaded,
                                    data);
+        g_object_unref(file);
     }
 }
 
diff --git a/test/test-install-script.c b/test/test-install-script.c
index d62e36d..7b16552 100644
--- a/test/test-install-script.c
+++ b/test/test-install-script.c
@@ -194,6 +194,7 @@ START_TEST(test_script_data)
 
     g_file_load_contents(file, NULL, &data, NULL, NULL, &error);
     fail_unless(error == NULL, error ? error->message : "none");
+    g_object_unref(file);
 
     osinfo_loader_process_path(loader, SRCDIR "/test/dbdata", &error);
     fail_unless(error == NULL, error ? error->message : "none");
-- 
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