[gnome-commander/gcmd-1-2-8] Fix for memory leak



commit 4851161038d102d8384ce550fe319b08ca15b5e9
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Wed Feb 2 19:28:45 2011 +0100

    Fix for memory leak

 src/gnome-cmd-smb-path.cc |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/gnome-cmd-smb-path.cc b/src/gnome-cmd-smb-path.cc
index 8d14216..fddde6a 100644
--- a/src/gnome-cmd-smb-path.cc
+++ b/src/gnome-cmd-smb-path.cc
@@ -262,7 +262,6 @@ GnomeCmdPath *gnome_cmd_smb_path_new_from_str (const gchar *path_str)
     g_return_val_if_fail (path_str != NULL, NULL);
 
     gchar *s, *t;
-    gchar **v;
     gchar *a = NULL,
           *b = NULL,
           *c = NULL;
@@ -276,11 +275,15 @@ GnomeCmdPath *gnome_cmd_smb_path_new_from_str (const gchar *path_str)
     g_strdelimit (s, "\\", '/');
 
     // Eat up all leading slashes
-    for (; *s=='/'; ++s)
-        if (!strlen (s))
-            return NULL;
+    for (; *s && *s=='/'; ++s);
 
-    v = g_strsplit (s, G_DIR_SEPARATOR_S, 0);
+    if (!*s)
+    {
+        g_free (t);
+        return NULL;
+    }
+
+    gchar **v = g_strsplit (s, G_DIR_SEPARATOR_S, 0);
     g_free (t);
 
     if (v[0] != NULL)



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