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

PATCH: Re: BUG: hrealloc() wants to realloc pushed memory



Bart Schaefer wrote:

> The zstyle command from zsh-users/3404 produces the error.  It may have
> something to do with invoking completion at the PS2 prompts -- I see it
> when cut'n'pasting lines with leading tabs like this:
> 
> zstyle -e ':completion:*:ssh:*' hosts \
> 	'reply=($(sed -e "/^#/d" -e "s/ .*\$//" -e "s/,/ /g" \
> 		/etc/ssh_known_hosts ~/.ssh/known_hosts 2>/dev/null))'

Whoa. That's a very old bug. get_comp_string() pushes a heap, but
doesn't pop it, that has to be done in docomplete(). And that didn't
do it when inside a string that begins in the chline string (the stuff 
on previous lines in a multi-line buffer, the part we can't edit).

Bye
 Sven

Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.19
diff -u -r1.19 zle_tricky.c
--- Src/Zle/zle_tricky.c	2000/08/11 12:19:35	1.19
+++ Src/Zle/zle_tricky.c	2000/08/29 08:19:13
@@ -581,7 +581,8 @@
     qisuf = ztrdup("");
     zsfree(autoq);
     autoq = NULL;
-    /* Get the word to complete. */
+    /* Get the word to complete.
+     * NOTE: get_comp_string() calls pushheap(), but not popheap(). */
     noerrs = 1;
     s = get_comp_string();
     DPUTS(wb < 0 || cs < wb || cs > we,
@@ -603,6 +604,7 @@
 	    strcpy((char *) line, ol);
 	    ll = strlen((char *) line);
 	    cs = ocs;
+	    popheap();
 	    unmetafy_line();
 	    zsfree(s);
 	    zsfree(qword);

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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