nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] one more undo failure


From: Mark Majeres
Subject: Re: [Nano-devel] one more undo failure
Date: Sat, 21 Jun 2014 19:07:00 -0700

>> By the way, in redo_cut() there is a free(cutbuffer).  Shouldn't
>> that be a free_filestruct(cutbuffer), like in undo_cut()?
>
> Yes, it should.  That's a potential leak point, but it would be better
> replaced by cutbuffer_reset().  This line in undo_cut() is also a leak
> point:
>
> cutbuffer = copy_filestruct(u->cutbuffer);
>
> There's likely to be other leaks like these two.  There should really
> be a cutbuffer.c module with a static cutbuffer variable and access
> methods, instead of the current extern cutbuffer with global access.
>
>
>> And the lines around there, fiddling witj openfile->mark_set,
>> would it be nicer to regroup these as:
>>
>>     if (!ISSET(CUT_TO_END))
>>         openfile->mark_set = TRUE;
>>     else
>>         openfile->mark_set = u->mark_set;
>>     openfile->mark_begin = fsfromline(u->mark_begin_lineno);
>>     openfile->mark_begin_x = (u->xflags == UNcut_cutline) ? 0 :
>> u->mark_begin_x;
>
> Yeah, that looks like a good idea too.
>

Patch is attached that removes the leaks.

Attachment: cutbuffer_leaks.patch
Description: Text Data


reply via email to

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