Leak in nautilus-file-utilities.c



Hi.

Valgrind reports this leak:

==21689== 36886 (36478 direct, 408 indirect) bytes in 873 blocks are definitely lost in loss record 245 of 256
==21689==    at 0x3414E292: malloc (vg_replace_malloc.c:130)
==21689==    by 0x731AAF: g_malloc (in /usr/lib/libglib-2.0.so.0.600.3)
==21689==    by 0x48FA5A2: gnome_vfs_unescape_string (in /usr/lib/libgnomevfs-2.so.0.1000.0)
==21689==    by 0x48F8ECB: gnome_vfs_uri_extract_short_name (in /usr/lib/libgnomevfs-2.so.0.1000.0)
==21689==    by 0x4D74F75: nautilus_get_uri_shortname_for_display (in /usr/lib/libnautilus-private.so.2.0.0)
==21689==    by 0x8085A4C: nautilus_spatial_window_set_location_button (nautilus-spatial-window.c:551)
==21689==    by 0x8088554: nautilus_window_report_load_underway (nautilus-window-manage-views.c:1177)
==21689==    by 0x4DA66C8: nautilus_window_info_report_load_underway (in /usr/lib/libnautilus-private.so.2.0.0)
==21689==    by 0x8098C16: ??? (fm-directory-view.c:7061)

Which I think can be fixed by the following patch?

Index: nautilus-file-utilities.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file-utilities.c,v
retrieving revision 1.123
diff -u -p -r1.123 nautilus-file-utilities.c
--- nautilus-file-utilities.c	14 Jan 2005 10:40:11 -0000	1.123
+++ nautilus-file-utilities.c	30 Mar 2005 11:01:25 -0000
@@ -472,6 +472,7 @@ nautilus_get_uri_shortname_for_display (
 	} else if (g_ascii_strcasecmp (uri->method_string, "file") == 0) {
 		text_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_PASSWORD);
 		local_file = gnome_vfs_get_local_path_from_uri (text_uri);
+		g_free (name);
 		name = g_filename_display_basename (local_file);
 		g_free (local_file);
 		g_free (text_uri);

Does that look right?

Cheers
Kjartan





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