[gnome-commander/gcmd-1-2-8] 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/gcmd-1-2-8] Eliminate redundant g_strdup() and fix for memory leak
- Date: Tue, 1 Feb 2011 21:57:39 +0000 (UTC)
commit 98ac13190645d500bdadc173845f4b7cb51ff6a0
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 76c42ea..8d14216 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]