From 4f7a774746b0957e8b62e41f27a82b543b6ccf5a Mon Sep 17 00:00:00 2001 From: monsta Date: Tue, 4 Nov 2014 14:46:43 +0300 Subject: don't leak memory --- src/file-utils.c | 5 ++--- src/fr-command-tar.c | 4 +++- src/glib-utils.c | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/file-utils.c b/src/file-utils.c index 1491790..3b33480 100644 --- a/src/file-utils.c +++ b/src/file-utils.c @@ -953,7 +953,7 @@ gboolean is_temp_work_dir (const char *dir) { int i; - char *folder; + char *folder = NULL; if (strncmp (dir, "file://", 7) == 0) dir = dir + 7; @@ -961,16 +961,15 @@ is_temp_work_dir (const char *dir) return FALSE; for (i = 0; try_folder[i] != NULL; i++) { - folder = ith_temp_folder_to_try (i); if (strncmp (dir, folder, strlen (folder)) == 0) if (strncmp (dir + strlen (folder), "/.fr-", 5) == 0) { g_free (folder); return TRUE; } + g_free (folder); } - g_free (folder); return FALSE; } diff --git a/src/fr-command-tar.c b/src/fr-command-tar.c index f1a89ce..27deafa 100644 --- a/src/fr-command-tar.c +++ b/src/fr-command-tar.c @@ -241,8 +241,10 @@ begin_tar_command (FrCommand *comm) command = g_find_program_in_path ("gtar"); #if defined (__SVR4) && defined (__sun) - if (g_file_test ("/usr/sfw/bin/gtar", G_FILE_TEST_IS_EXECUTABLE)) + if (g_file_test ("/usr/sfw/bin/gtar", G_FILE_TEST_IS_EXECUTABLE)) { + g_free (command); command = g_strdup ("/usr/sfw/bin/gtar"); + } #endif if (command != NULL) fr_process_begin_command (comm->process, command); diff --git a/src/glib-utils.c b/src/glib-utils.c index 176370c..669499b 100644 --- a/src/glib-utils.c +++ b/src/glib-utils.c @@ -94,6 +94,8 @@ str_substitute (const char *str, gstr = g_string_append (gstr, to_str); } + g_strfreev (tokens); + return g_string_free (gstr, FALSE); } -- cgit v1.2.1