[smbfs.c]: Fix recently introduced memory leak

Roland Illig roland.illig at gmx.de
Thu Aug 19 15:27:47 UTC 2004


Andrew V. Samoilov wrote:
> Hi, Roland!
> 
> 
>>I have applied a slight variant of your patch. Your patch didn't fix a 
>>memory leak (to my knowledge), but I discovered one while checking and 
> 
> 
> What about previous smbfs_get_remote_stat(), smbfs_mkdir() and smbfs_rmdir()?

smbfs_get_remote_stat():

char *mypath = g_strdup(path);
...
smbfs_convert_path (&mypath, FALSE); /* in-place editing */
...
if (condition) {
     ...
     free (mypath);
     return;
} else {
     ...
     free (mypath);
     return;
}

That's the part that matters to the mypath variable. I can't see any 
memory leak here. Ah, well, it's the smbfs_convert_path() function that 
had leaked. Sorry, sorry, sorry. Now I see it.

> BTW, these lines are from HACKING:
 > [...]
> changes.  The developer applying your patch can format the code for you.

Sorry, I had forgotten to remember this line while committing. I'll make 
up for it.

> P.S. Please use () after function name in ChangeLog(s) entries and begin this one with 
> * filename (function): Description .

I'll do.

Roland



More information about the mc-devel mailing list