Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug#535232: zsh: segfaults while trying to free in hend



On Sun, 9 Aug 2009 18:47:21 +0000
Clint Adams <schizo@xxxxxxxxxx> wrote:
> On Tue, Jun 30, 2009 at 06:21:33PM -0400, Alec Berryman wrote:
>> Recently (one or two weeks, probably when I upgraded to the current
>> version of zsh), I've been seeing intermittent segfaults - I'll run a
>> command like less or cd and my terminal will die on me.  I've never
>> seen it happen in a long-running shell; if it makes it through the
>> first few commands, everything works.

The following is at least safe and good practice, but it's impossible to
tell if it's the root of the problem.

Index: Src/hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hist.c,v
retrieving revision 1.94
diff -u -r1.94 hist.c
--- Src/hist.c	23 Mar 2009 12:17:33 -0000	1.94
+++ Src/hist.c	16 Aug 2009 18:59:10 -0000
@@ -1156,6 +1156,7 @@
 	zfree(chline, hlinesz);
 	zfree(chwords, chwordlen*sizeof(short));
 	chline = NULL;
+	chwords = NULL;
 	histactive = 0;
 	unqueue_signals();
 	return 1;
@@ -1270,6 +1271,7 @@
     zfree(chline, hlinesz);
     zfree(chwords, chwordlen*sizeof(short));
     chline = NULL;
+    chwords = NULL;
     histactive = 0;
     if (isset(SHAREHISTORY)? histfileIsLocked() : isset(INCAPPENDHISTORY))
 	savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST);


-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author