missing(?) g_free in vfolder-method.c [patch]



While reading vfolder-method.c trying to figure out how it works ;) I
noticed that in the function get_file_info_internal() in the first "if"
branch file_info->mime_type and ->name are freed before the new value is
strdup'ed, but in the other branch (which calls
fill_file_info_for_directory() ) they are not.

Can someone who actually understands the code review and, if needed,
apply the attached patch?

ciao
	paolo

--- gnome2/gnome-vfs/modules/vfolder/vfolder-method.c	2002-12-13 19:03:48.000000000 +0100
+++ gnome-vfs/modules/vfolder/vfolder-method.c	2003-02-04 20:20:48.000000000 +0100
@@ -636,6 +636,7 @@
 
 	GNOME_VFS_FILE_INFO_SET_LOCAL (file_info, TRUE);
 
+	g_free(file_info->mime_type);
 	file_info->mime_type = g_strdup ("x-directory/vfolder-desktop");
 	file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE;
 
@@ -644,6 +645,7 @@
 	file_info->valid_fields |= (GNOME_VFS_FILE_INFO_FIELDS_CTIME |
 				    GNOME_VFS_FILE_INFO_FIELDS_MTIME);
 
+	g_free(file_info->name);
 	file_info->name = g_strdup (name);
 
 	if (read_only) {
@@ -668,6 +670,7 @@
 
 		GNOME_VFS_FILE_INFO_SET_SYMLINK (file_info, TRUE);
 
+		g_free(file_info->symlink_name);
 		file_info->symlink_name = g_strdup (link_ref);
 		file_info->valid_fields |= 
 			GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME;


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