nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] Memory leak in browser


From: Rishabh Dave
Subject: Re: [Nano-devel] Memory leak in browser
Date: Wed, 24 Feb 2016 23:06:34 +0530

On Tue, Feb 23, 2016 at 2:09 AM, Benno Schulenberg <address@hidden> wrote:

> Manner #1 -
>
> +               temp = striponedir(filelist[selected]);
> +               prev_dir = mallocstrcpy(NULL, temp);

Why not simply free 'prev_dir' at the end of the routine?


Won't that lead to a memory leak? To reassign the address of memory full of new string, we must first un-assign the address of memory full of old string. I tried valgrind, we will have leaks.

Inline assignment, done and 'temp' is declared and freed locally. I have attached a patch, in case it does lead to memory leak. :)

Attachment: temp-localized.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]