Fix a couple of memory leaks



Hi,

I just commited the following patch which plugs a couple of mem leaks.

Cheers,
Gustavo



? .tm_project.cache
? autom4te.cache
? gdl.new_dock.patch
? stamp-h1
Index: gdl/gdl-icons.c
===================================================================
RCS file: /cvs/gnome/gdl/gdl/gdl-icons.c,v
retrieving revision 1.2
diff -u -r1.2 gdl-icons.c
--- gdl/gdl-icons.c	9 Apr 2002 21:08:58 -0000	1.2
+++ gdl/gdl-icons.c	28 May 2002 00:48:23 -0000
@@ -227,7 +227,7 @@
 			   const char *icon_name, 
 			   unsigned size)
 {
-	char *themed_icon_name, *path;
+	char *themed_icon_name, *path = NULL;
 	int i;
 
 	if (icon_name[0] == '/') {
@@ -251,13 +251,15 @@
 		}
 
 		if (g_file_test (path, G_FILE_TEST_EXISTS)) {
-			return path;
+			break;
 		}
 
 		g_free (path);
+		path = NULL;
 	}
+	g_free (themed_icon_name);
 	
-	return NULL;
+	return path;
 }
 
 
@@ -365,8 +367,9 @@
 		} else {
 			pixbuf = scale_icon (gdk_pixbuf_new_from_file (path, NULL));
 		}
+		g_free (path);
 	}
-
+	
 	if (!pixbuf) {
 		pixbuf = gdk_pixbuf_new_from_data (default_icon,
 						   GDK_COLORSPACE_RGB,


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