[gnome-commander] Fix for memory leak



commit cf89a586bfb49ccdd948feca35daa9da615df797
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 0b46f37..fd0867e 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]