Re: Memory leak in gnome-vfs-daemon

"James \"Doc\" Livingston" <[email protected]>
Newsgroups gmane.comp.gnome.vfs.general
Message-ID <1194960939.9385.12.camel@alyrion>
On Wed, 2007-11-14 at 00:12 +1100, James "Doc" Livingston wrote:
> I recently noticed that after getting Rhythmbox to import music from a
> SMB share gnome-vfs-daemon was using about 60Mb of private dirty heap
> space. After valgrind-ing it, it looks like GnomeVFSURIs are being
> leaked quite often.

And as a follow-up to myself, I've just found another leak - this time
in the SMB method where it's not free'ing the return value of
gnome_vfs_escape_string().


--- modules/smb-method.c	(revision 5416)
+++ modules/smb-method.c	(working copy)
@@ -2084,6 +2084,7 @@ do_read_directory (GnomeVFSMethod *metho
 	struct stat st;
 	char *statpath;
 	char *path;
+	char *escaped;
 	int r = -1;
 	GList *l;
 
@@ -2178,17 +2179,20 @@ do_read_directory (GnomeVFSMethod *metho
 	case SMBC_DIR:
 	case SMBC_FILE:
 		path = dh->path;
-		
+		escaped = gnome_vfs_escape_string (file_info->name);
+
 		if (path[strlen(path)-1] == '/') {
 			statpath = g_strconcat (path, 
-						gnome_vfs_escape_string (file_info->name),
+						escaped,
 						NULL);
 		} else {
 			statpath = g_strconcat (path,
 						"/",
-						gnome_vfs_escape_string (file_info->name),
+						escaped,
 						NULL);
 		}
+		g_free (escaped);
+
 		/* TODO: might give an auth error, but should be rare due
 		   to the succeeding opendir. If this happens and we can't
 		   auth, we should terminate the readdir to avoid multiple




Cheers,

-- 
"We're standing there pounding a dead parrot on the counter, and the
management response is to frantically swap in new counters to see if
that fixes the problem." -- Peter Gutmann
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.