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

Re: PATCH (4.0.x, 4.1.x): Re: Core dump bug in ZSH version 3.0.7



Bart wrote:

> On Nov 14,  9:57am, Wischnowsky, Sven wrote:
> } 
> } [ Hi, folks! ]
> 
> [ Hi, Sven! ]
> 
> } My change put that cleanup-loop in a separate function, 
> though, and made
> } that function be called anywhere where we call bld_eprog() 
> (if (success)),
> } just to make sure...
> 
> I'll hold off committing mine, then.

Well, here is mine. As I said, I currently don't have the possibility
to commit it even if everyone accepts this patch.

Bye
  Sven

diff -ur ../oz/Src/parse.c ./Src/parse.c
--- ../oz/Src/parse.c	Tue Nov 13 21:51:59 2001
+++ ./Src/parse.c	Tue Nov 13 22:14:14 2001
@@ -420,6 +420,18 @@
     return (!p || !p->prog || *p->prog == WCB_END());
 }
 
+static void
+clear_hdocs()
+{
+    struct heredocs *p, *n;
+
+    for (p = hdocs; p; p = n) {
+        n = p->next;
+        zfree(p, sizeof(struct heredocs));
+    }
+    hdocs = NULL;
+}
+
 /*
  * event	: ENDINPUT
  *			| SEPER
@@ -435,7 +447,12 @@
     aliasspaceflag = 0;
     yylex();
     init_parse();
-    return ((par_event()) ? bld_eprog() : NULL);
+
+    if (!par_event()) {
+        clear_hdocs();
+        return NULL;
+    }
+    return bld_eprog();
 }
 
 /**/
@@ -509,6 +526,7 @@
     init_parse();
     par_list(&c);
     if (tok != ENDINPUT) {
+        clear_hdocs();
 	tok = LEXERR;
 	yyerror(0);
 	return NULL;
@@ -522,9 +540,10 @@
 {
     init_parse();
 
-    if (!par_cond())
+    if (!par_cond()) {
+        clear_hdocs();
 	return NULL;
-
+    }
     return bld_eprog();
 }
 



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