Skip to content

gio: Fix GFileEnumerator leaks in gio tools

correctmost requested to merge correctmost/glib:cm/fix-gio-tools-leaks into main

Leak report

24,440 (160 direct, 24,280 indirect) bytes in 1 blocks are definitely lost in loss record 1,970 of 1,970
   at 0x4BA26A0: g_type_create_instance (gtype.c:1928)
   by 0x4B84F87: g_object_new_internal (gobject.c:2606)
   by 0x4B86E9C: g_object_new_valist (gobject.c:2945)
   by 0x4B8764B: g_object_new (gobject.c:2418)
   by 0x498C113: _g_local_file_enumerator_new (glocalfileenumerator.c:253)
   by 0x498967F: g_local_file_enumerate_children (glocalfile.c:552)
   by 0x48BE74B: g_file_enumerate_children (gfile.c:1109)
   by 0x11274D: list (gio-tool-list.c:127)
   by 0x112D18: handle_list (gio-tool-list.c:232)
   by 0x110A72: main (gio-tool.c:348)

24,536 (160 direct, 24,376 indirect) bytes in 1 blocks are definitely lost in loss record 1,984 of 1,985
   at 0x4BA26A0: g_type_create_instance (gtype.c:1928)
   by 0x4B84F87: g_object_new_internal (gobject.c:2606)
   by 0x4B86E9C: g_object_new_valist (gobject.c:2945)
   by 0x4B8764B: g_object_new (gobject.c:2418)
   by 0x498C113: _g_local_file_enumerator_new (glocalfileenumerator.c:253)
   by 0x498967F: g_local_file_enumerate_children (glocalfile.c:552)
   by 0x48BE74B: g_file_enumerate_children (gfile.c:1109)
   by 0x11824D: do_tree (gio-tool-tree.c:80)
   by 0x11860B: tree (gio-tool-tree.c:231)
   by 0x118802: handle_tree (gio-tool-tree.c:289)
   by 0x110A72: main (gio-tool.c:348)

Testing

  • No issues were detected when testing the patch with Valgrind, LSan, and ASan
  • I wasn't able to trigger a leak report for gio-tool-trash with Valgrind or LSan, but I verified the new g_object_unref call is executed

Merge request reports

Loading