Re: Opening files that start with %



Ok, insert g_free(safe_fname) after its last use.

John

In message <3D40A88B 4040804 daa com au>, James Henstridge writes:

>jgotts linuxsavvy com wrote:
>
>>http://bugzilla.gnome.org/show_bug.cgi?id=88899
>>
>>It should be noted that you fixed the bug for gedit 2.0 *only*.  Attached is
>>a patch for gedit 0.9.7 that appears to work.  As the original reporter noted
>,
>>other applications such as nautilus will have to be checked and fixed as well
>.
>>I'll leave that to some other brave soul.
>>
>>John
>>
>>--- gedit-0.9.7/src/file.c.orig	Thu Jul 25 20:31:24 2002
>>+++ gedit-0.9.7/src/file.c	Thu Jul 25 20:32:40 2002
>>@@ -195,6 +195,7 @@
>> 	GnomeVFSResult  result;
>> 	GString *tmp_buf = NULL;
>> 	GeditView *view;
>>+	char *safe_fname;
>> 			
>> 	gedit_debug (DEBUG_FILE, "");
>> 
>>@@ -207,7 +208,8 @@
>> 		  gtk_main_iteration ();
>> 
>> 	info = gnome_vfs_file_info_new ();
>>-	result = gnome_vfs_get_file_info (fname, 
>>+	safe_fname = gnome_vfs_escape_path_string(fname);
>>+	result = gnome_vfs_get_file_info (safe_fname, 
>> 					  info,
>> 					  (GNOME_VFS_FILE_INFO_GET_MIME_TYPE
>> 					   | GNOME_VFS_FILE_INFO_FOLLOW_LINKS))
>;
>>@@ -251,7 +253,7 @@
>> 		return 1;	
>> 	}
>> 
>>-	result = gnome_vfs_open (&from_handle, fname, GNOME_VFS_OPEN_READ);
>>+	result = gnome_vfs_open (&from_handle, safe_fname, GNOME_VFS_OPEN_READ)
>;
>> 	if (result != GNOME_VFS_OK)
>> 	{
>> 		gchar *errstr = g_strdup_printf (_("An error was encountered wh
>ile reading the file: \n\n%s\n\n"
>>  
>>
>The patch above appears to leak safe_fname.
>
>James.
>
>-- 
>Email: james daa com au              | Linux.conf.au 2003 Call for Papers out
>WWW:   http://www.daa.com.au/~james/ |   http://conf.linux.org.au/cfp.html
>
>
>
>_______________________________________________
>gnome-list mailing list
>gnome-list gnome org
>http://mail.gnome.org/mailman/listinfo/gnome-list

-- 
John GOTTS <jgotts linuxsavvy com>  http://linuxsavvy.com/staff/jgotts



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