glib r6356 - trunk/gio



Author: alexl
Date: Tue Jan 22 16:16:32 2008
New Revision: 6356
URL: http://svn.gnome.org/viewvc/glib?rev=6356&view=rev

Log:
2008-01-22  Alexander Larsson  <alexl redhat com>

        * gdesktopappinfo.c:
	(g_desktop_app_info_new):
	Don't leak basename.



Modified:
   trunk/gio/ChangeLog
   trunk/gio/gdesktopappinfo.c

Modified: trunk/gio/gdesktopappinfo.c
==============================================================================
--- trunk/gio/gdesktopappinfo.c	(original)
+++ trunk/gio/gdesktopappinfo.c	Tue Jan 22 16:16:32 2008
@@ -292,13 +292,15 @@
 {
   GDesktopAppInfo *appinfo;
   const char * const *dirs;
+  char *basename;
   int i;
 
   dirs = get_applications_search_path ();
 
+  basename = g_strdup (desktop_id);
+  
   for (i = 0; dirs[i] != NULL; i++)
     {
-      char *basename;
       char *filename;
       char *p;
 
@@ -306,11 +308,8 @@
       appinfo = g_desktop_app_info_new_from_filename (filename);
       g_free (filename);
       if (appinfo != NULL)
-	{
-	  goto found;
-	}
+	goto found;
 
-      basename = g_strdup (desktop_id);
       p = basename;
       while ((p = strchr (p, '-')) != NULL)
 	{
@@ -320,18 +319,18 @@
 	  appinfo = g_desktop_app_info_new_from_filename (filename);
 	  g_free (filename);
 	  if (appinfo != NULL)
-	    {
-	      g_free (basename);
-	      goto found;
-	    }
+	    goto found;
 	  *p = '-';
 	  p++;
 	}
     }
   
+  g_free (basename);
   return NULL;
 
  found:
+  g_free (basename);
+  
   appinfo->desktop_id = g_strdup (desktop_id);
 
   if (g_desktop_app_info_get_is_hidden (appinfo))



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