[gnome-commander] Eliminate redundant g_strdup() and fix for memory leak
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Eliminate redundant g_strdup() and fix for memory leak
- Date: Tue, 1 Feb 2011 21:55:40 +0000 (UTC)
commit ff4a077234810a42475c32e86ac24965af06b638
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Tue Feb 1 22:48:17 2011 +0100
Eliminate redundant g_strdup() and fix for memory leak
src/gnome-cmd-smb-path.cc | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/gnome-cmd-smb-path.cc b/src/gnome-cmd-smb-path.cc
index 525a6ec..0b46f37 100644
--- a/src/gnome-cmd-smb-path.cc
+++ b/src/gnome-cmd-smb-path.cc
@@ -270,13 +270,10 @@ GnomeCmdPath *gnome_cmd_smb_path_new_from_str (const gchar *path_str)
DEBUG('s', "Creating smb-path for %s\n", path_str);
- t = g_strdup (path_str);
+ s = t = g_strdup (path_str);
// Replace '\' with '/'
- g_strdelimit (t, "\\", '/');
-
- s = g_strdup (t);
- g_free (t);
+ g_strdelimit (s, "\\", '/');
// Eat up all leading slashes
for (; *s=='/'; ++s)
@@ -284,6 +281,8 @@ GnomeCmdPath *gnome_cmd_smb_path_new_from_str (const gchar *path_str)
return NULL;
v = g_strsplit (s, G_DIR_SEPARATOR_S, 0);
+ g_free (t);
+
if (v[0] != NULL)
{
a = g_strdup (v[0]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]