Skip to content

Fix leak during search

correctmost requested to merge correctmost/thunar:cm/fix-uri-leak into master

Example leak report from LeakSanitizer:

Direct leak of 20715 byte(s) in 249 object(s) allocated from:
    #0 0x55f574da59c9 in malloc (/usr/local/bin/thunar+0x44c9c9)
    #1 0x7f4a790e0902 in g_malloc /usr/src/debug/glib2/build/../glib/glib/gmem.c:100:13
    #2 0x7f4a790f7842 in g_strconcat /usr/src/debug/glib2/build/../glib/glib/gstrfuncs.c:585:12
    #3 0x7f4a790b920b in g_escape_file_uri /usr/src/debug/glib2/build/../glib/glib/gconvert.c:1423:9
    #4 0x7f4a790b920b in g_filename_to_uri /usr/src/debug/glib2/build/../glib/glib/gconvert.c:1762:17
    #5 0x55f574ef0db7 in _thunar_search_folder /home/s/code/thunar/thunar/thunar-io-jobs.c:1584:46
    #6 0x55f574ef0dd2 in _thunar_search_folder /home/s/code/thunar/thunar/thunar-io-jobs.c:1584:11
    #7 0x55f574ef0dd2 in _thunar_search_folder /home/s/code/thunar/thunar/thunar-io-jobs.c:1584:11
    #8 0x55f574ef0dd2 in _thunar_search_folder /home/s/code/thunar/thunar/thunar-io-jobs.c:1584:11
    #9 0x55f574ef0dd2 in _thunar_search_folder /home/s/code/thunar/thunar/thunar-io-jobs.c:1584:11
    #10 0x55f574eedda7 in _thunar_job_search_directory /home/s/code/thunar/thunar/thunar-io-jobs.c:1648:3
    #11 0x55f574fa5110 in thunar_simple_job_execute /home/s/code/thunar/thunar/thunar-simple-job.c:119:13
    #12 0x7f4a7a076aeb in exo_job_scheduler_job_func /home/s/code/exo/exo/exo-job.c:310:14
    #13 0x7f4a7923fefd in io_job_thread /usr/src/debug/glib2/build/../glib/gio/gioscheduler.c:75:16
    #14 0x7f4a792731d7 in g_task_thread_pool_thread /usr/src/debug/glib2/build/../glib/gio/gtask.c:1583:3
    #15 0x7f4a7910ebc2 in g_thread_pool_thread_proxy /usr/src/debug/glib2/build/../glib/glib/gthreadpool.c:336:15
    #16 0x7f4a79109064 in g_thread_proxy /usr/src/debug/glib2/build/../glib/glib/gthread.c:835:20
    #17 0x55f574cdd076 in asan_thread_start(void*) (/usr/local/bin/thunar+0x384076) (BuildId: 88ea57a4e755b829)
    #18 0x7f4a78eca559 in start_thread /usr/src/debug/glibc/glibc/nptl/pthread_create.c:447:8
    #19 0x7f4a78f47a3b in clone3 /usr/src/debug/glibc/glibc/misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Testing

  • I verified the leak no longer shows up in Valgrind and LeakSanitizer
  • I verified no memory errors are reported by Valgrind and AddressSanitizer

Merge request reports

Loading