nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] Patch for bug #44950


From: Benno Schulenberg
Subject: Re: [Nano-devel] Patch for bug #44950
Date: Sun, 17 Jan 2016 22:04:35 +0100

On Sun, Jan 17, 2016, at 19:04, Rishabh Dave wrote:
> First of all, sorry for late reply

No worries, there is no hurry.

> /* Determine whether the components in a path are valid directories. If
>  * some component is faulty, display faulty path and turn faulty_path TRUE.

The comment is not accurate any more; it doesn't check whether all
components in the path are valid dirs; it just checks whether the
specified file is located in an actual, existing directory.

> Memory leak is pointed out at line 5 (first line in function) irrespective
> of whatever I use (mallocstrcpy() or a combination malloc() and strcpy()).

With the attached, somewhat modified patch, I don't get the
leak any more.

(It just leaks in get_full_path(), but that is unrelated.)

(The patch does not apply cleanly to 2.5.1; things have changed
in SVN; you can ignore the reject for testing purposes.)

> If 'free(parentdir)' inside if-block is not under a comment, nano crashes
> with shell reporting 'free(): invalid pointer: '.

For me it didn't crash; it was just valgrind that pointed it out.

> If do 'src/nano foo/bar' some more code would leak memory that I haven't
> touched. The problem is same as one I stumbled upon using valgrind in very
> previous mail.

Yes.  Part of it has been fixed in SVN.

> Can anyone help by directing me here? A reference would also be enough.

I don't know why your version leaks, and mine doesn't.
This memory management stuff is abracadabra to me.

> I will take care of rest - learning it and mending it; if there is no hurry
> to get patch ready for next release.

There is no rush.

> Other than memory leak, is rest of the patch fine enough to call it final?

I will give things different names, and I've moved the beep,
but for the rest it's okay, as far as I'm concerned.

Benno

-- 
http://www.fastmail.com - Does exactly what it says on the tin

Attachment: dir-does-not-exist.patch
Description: Text Data


reply via email to

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