diff options
author | monsta <monsta@inbox.ru> | 2014-11-04 14:46:43 +0300 |
---|---|---|
committer | infirit <infirit@gmail.com> | 2014-11-19 15:42:44 +0100 |
commit | 4f7a774746b0957e8b62e41f27a82b543b6ccf5a (patch) | |
tree | fc5c761496151830a3bfae0388d905e7390b9842 | |
parent | 9574a0925e764867c810c35bbff16ab0bae8c930 (diff) | |
download | engrampa-4f7a774746b0957e8b62e41f27a82b543b6ccf5a.tar.bz2 engrampa-4f7a774746b0957e8b62e41f27a82b543b6ccf5a.tar.xz |
don't leak memory
-rw-r--r-- | src/file-utils.c | 5 | ||||
-rw-r--r-- | src/fr-command-tar.c | 4 | ||||
-rw-r--r-- | src/glib-utils.c | 2 |
3 files changed, 7 insertions, 4 deletions
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); } |