Patch for some leakage



Hi,

these patches fix a few small memory leaks in nautilus/eel.

Note that I'm not completely sure if the preferences_get_value() call in
preferences_entry_invoke_callbacks() is needed or not (I don't think
so). If it is, new_value has to be freed of course.

On a related note: Nautilus used to apply the hidden file pref instantly
to all open windows, but on head it doesn't anymore. At first I thought
this is caused by my patch, but I re-pulled a fresh tree and the pref is
still not applied to open windows. Does anybody else see this on HEAD?

Martin

Index: libnautilus-private/nautilus-desktop-link.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-desktop-link.c,v
retrieving revision 1.4
diff -p -u -r1.4 nautilus-desktop-link.c
--- libnautilus-private/nautilus-desktop-link.c	27 Jun 2003 15:14:22 -0000	1.4
+++ libnautilus-private/nautilus-desktop-link.c	17 Oct 2003 11:42:59 -0000
@@ -367,6 +367,14 @@ desktop_link_finalize (GObject *object)
 						 link);
 	}
 	
+	if (link->details->type == NAUTILUS_DESKTOP_LINK_VOLUME) {
+		g_free (link->details->mount_path);
+	}
+
+	g_free (link->details->filename);
+	g_free (link->details->display_name);
+	g_free (link->details->activation_uri);
+	g_free (link->details->icon);
 	g_free (link->details);
 
 	EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
Index: libnautilus-private/nautilus-file-operations.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file-operations.c,v
retrieving revision 1.166
diff -p -u -r1.166 nautilus-file-operations.c
--- libnautilus-private/nautilus-file-operations.c	18 Sep 2003 14:52:16 -0000	1.166
+++ libnautilus-private/nautilus-file-operations.c	17 Oct 2003 11:43:03 -0000
@@ -1054,7 +1054,8 @@ handle_transfer_overwrite (const GnomeVF
 			(parent_for_error_dialog (transfer_info), TRUE, text, 
 			 _("Conflict while copying"),
 			 _("Replace"), _("Skip"), NULL);
-			 
+		g_free (text);	 
+
 		nautilus_file_operations_progress_resume_timeout (transfer_info->progress_dialog);
 					 
 		switch (result) {
@@ -1071,6 +1072,7 @@ handle_transfer_overwrite (const GnomeVF
 			(parent_for_error_dialog (transfer_info), TRUE, text, 
 			 _("Conflict while copying"),
 			 _("Replace All"), _("Replace"), _("Skip"), NULL);
+		g_free (text);
 
 		nautilus_file_operations_progress_resume_timeout (transfer_info->progress_dialog);
 
Index: libnautilus-private/nautilus-file.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file.c,v
retrieving revision 1.328
diff -p -u -r1.328 nautilus-file.c
--- libnautilus-private/nautilus-file.c	19 Sep 2003 08:31:30 -0000	1.328
+++ libnautilus-private/nautilus-file.c	17 Oct 2003 11:43:10 -0000
@@ -1022,6 +1022,7 @@ rename_guts (NautilusFile *file,
 	 * But not for .desktop files as '/' are allowed for them */
 	if (strstr (new_name, "/") != NULL && !is_local_desktop_file) {
 		(* callback) (file, GNOME_VFS_ERROR_NOT_PERMITTED, callback_data);
+		g_free (uri);
 		return;
 	}
 	
@@ -1037,6 +1038,7 @@ rename_guts (NautilusFile *file,
 		 */
 		nautilus_file_changed (file);
 		(* callback) (file, GNOME_VFS_ERROR_NOT_FOUND, callback_data);
+		g_free (uri);
 		return;
 	}
 
@@ -1046,6 +1048,7 @@ rename_guts (NautilusFile *file,
 	 */
 	if (name_is (file, new_name)) {
 		(* callback) (file, GNOME_VFS_OK, callback_data);
+		g_free (uri);
 		return;
 	}
 
@@ -1060,6 +1063,7 @@ rename_guts (NautilusFile *file,
 		 */
 		nautilus_file_changed (file);
 		(* callback) (file, GNOME_VFS_ERROR_NOT_SUPPORTED, callback_data);
+		g_free (uri);
 		return;
 	}
 
@@ -1068,7 +1072,7 @@ rename_guts (NautilusFile *file,
 		NautilusDesktopLink *link;
 
 		link = nautilus_desktop_icon_file_get_link (NAUTILUS_DESKTOP_ICON_FILE (file));
-
+		
 		if (nautilus_desktop_link_rename (link, new_name)) {
 			(* callback) (file, GNOME_VFS_OK, callback_data);
 		} else {
@@ -1076,6 +1080,7 @@ rename_guts (NautilusFile *file,
 		}
 		
 		g_object_unref (link);
+		g_free (uri);
 		return;
 	}
 	
Index: libnautilus-private/nautilus-icon-factory.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-factory.c,v
retrieving revision 1.296
diff -p -u -r1.296 nautilus-icon-factory.c
--- libnautilus-private/nautilus-icon-factory.c	2 Sep 2003 15:58:28 -0000	1.296
+++ libnautilus-private/nautilus-icon-factory.c	17 Oct 2003 11:43:12 -0000
@@ -393,6 +393,7 @@ static void
 cache_key_destroy (CacheKey *key)
 {
 	g_free (key->name);
+	g_free (key->modifier);
 	g_free (key);
 }
 
Index: src/nautilus-application.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-application.c,v
retrieving revision 1.206
diff -p -u -r1.206 nautilus-application.c
--- src/nautilus-application.c	30 Sep 2003 20:37:13 -0000	1.206
+++ src/nautilus-application.c	17 Oct 2003 11:43:14 -0000
@@ -331,6 +331,7 @@ migrate_old_nautilus_files (void)
 				      _("Migrated old desktop"),
 				      NULL);
 	}
+	g_free (old_desktop_dir);
 	g_free (migrated_file);
 }
 
Index: src/nautilus-bookmark-list.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-bookmark-list.c,v
retrieving revision 1.43
diff -p -u -r1.43 nautilus-bookmark-list.c
--- src/nautilus-bookmark-list.c	18 Sep 2002 18:26:10 -0000	1.43
+++ src/nautilus-bookmark-list.c	17 Oct 2003 11:43:15 -0000
@@ -147,6 +147,7 @@ append_bookmark_node (gpointer data, gpo
 	if (icon != NULL) {
 		/* Don't bother storing modifier or embedded text for bookmarks. */
 		xmlSetProp (bookmark_node, "icon_name", icon);
+		g_free (icon);
 	}
 }
 
Index: eel/eel-preferences.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-preferences.c,v
retrieving revision 1.13
diff -p -u -r1.13 eel-preferences.c
--- eel/eel-preferences.c	22 Jul 2003 23:20:30 -0000	1.13
+++ eel/eel-preferences.c	17 Oct 2003 11:51:59 -0000
@@ -434,6 +434,7 @@ eel_preferences_set (const char *name,
 		eel_gconf_set_string (key, string_value);
 	}
 	g_free (key);
+	g_free (old_value);
 }
 
 char *
@@ -571,12 +572,8 @@ preferences_callback_entry_invoke_functi
 static void
 preferences_entry_invoke_callbacks (PreferencesEntry *entry)
 {
-	GConfValue *new_value;
-	
 	g_return_if_fail (entry != NULL);
 
-	new_value = preferences_get_value (entry->name);
-
 	/* Update the auto storage preferences */
 	if (entry->auto_storage_list != NULL) {
 		preferences_entry_update_auto_storage (entry);			


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