[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] Memory leak in browser
From: |
Benno Schulenberg |
Subject: |
Re: [Nano-devel] Memory leak in browser |
Date: |
Mon, 22 Feb 2016 21:39:53 +0100 |
On Mon, Feb 22, 2016, at 19:12, Rishabh Dave wrote:
> A free-statement was missing to deallocate the string returned by
> striponedir(), thanks to the comment in the source code before it.
>
> https://savannah.gnu.org/bugs/?47206
>
> Valgrind showed loss of 116 bytes instead of 32 bytes as in the comment #0
The number of bytes lost depends of course on how long the path
is to your current working directory when starting nano.
> Manner #1 -
>
> + temp = striponedir(filelist[selected]);
> + prev_dir = mallocstrcpy(NULL, temp);
Why not simply free 'prev_dir' at the end of the routine?
If that doesn't work, then just declare and free 'temp'
right there -- no need to spread it over 300 lines.
Benno
--
http://www.fastmail.com - Access your email from home and the web