[file-roller/gnome-3-16] Fix _g_file_is_temp_work_dir memory leak



commit 2e5de0b62e60358bf7184998faafb00f9001cff9
Author: David King <dking redhat com>
Date:   Thu Jul 16 10:35:13 2015 +0100

    Fix _g_file_is_temp_work_dir memory leak
    
    Found with Valgrind:
    
    ==9376== 47 bytes in 1 blocks are definitely lost in loss record 8,821
    of 17,916
    ==9376==    at 0x4C2BC50: malloc (in
    /usr/lib64/valgrind/vgpreload_memcheck-amd6
    4-linux.so)
    ==9376==    by 0x748B689: g_malloc (gmem.c:97)
    ==9376==    by 0x74A425E: g_strdup (gstrfuncs.c:356)
    ==9376==    by 0x41B94E: _g_file_is_temp_work_dir (file-utils.c:575)
    ==9376==    by 0x41BA2B: _g_file_is_temp_dir (file-utils.c:266)
    ==9376==    by 0x43C271: fr_window_add_to_recent_list (fr-window.c:2670)
    ==9376==    by 0x4457E0: _archive_operation_completed (fr-window.c:3019)
    ==9376==    by 0x4480BB: archive_list_ready_cb (fr-window.c:5881)
    ==9376==    by 0x6ED9ACC: g_simple_async_result_complete
    (gsimpleasyncresult.c:801)
    ==9376==    by 0x6ED9B3B: complete_in_idle_cb (gsimpleasyncresult.c:813)
    ==9376==    by 0x7485C89: g_main_dispatch (gmain.c:3122)
    ==9376==    by 0x7485C89: g_main_context_dispatch (gmain.c:3737)
    ==9376==    by 0x7486007: g_main_context_iterate.isra.29 (gmain.c:3808)
    ==9376==    by 0x74860AB: g_main_context_iteration (gmain.c:3869)
    ==9376==    by 0x6F0F5BB: g_application_run (gapplication.c:2311)
    ==9376==    by 0x414FE5: main (main.c:38)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752476

 src/file-utils.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/file-utils.c b/src/file-utils.c
index 008f37b..a60fca2 100644
--- a/src/file-utils.c
+++ b/src/file-utils.c
@@ -574,8 +574,10 @@ _g_file_is_temp_work_dir (GFile *file)
        int       i;
 
        path = g_file_get_path (file);
-       if (path[0] != '/')
+       if (path[0] != '/') {
+               g_free (path);
                return FALSE;
+       }
 
        for (i = 0; try_folder[i] != NULL; i++) {
                const char *folder;
@@ -589,6 +591,8 @@ _g_file_is_temp_work_dir (GFile *file)
                }
        }
 
+       g_free (path);
+
        return result;
 }
 


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