Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: hzoli change: $foo:s//r/
- X-seq: zsh-workers 322
- From: Thorsten Meinecke <kaefer@xxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Re: hzoli change: $foo:s//r/
- Date: Wed, 16 Aug 1995 16:49:30 +0200 (MET DST)
- In-reply-to: <199508161159.NAA01707@xxxxxxxxxxxxxxxxx> from "Zoltan Hidvegi" at Aug 16, 95 01:59:09 pm
- Organization: none. Location: Berlin, Germany
Another very minor problem with Zoltan's substitution code.
If hsubr is non-NULL, and a "bad/no previous substitution" error
occurs, hsubr is free()d. This may corrupt memory. Example:
$ PS1='[%!] ' ./zsh -f
[1] echo $foo:s/x//
[2] echo $foo:s/ //
zsh: bad substitution
[3] echo $foo:s/ //
zsh: attempt to free already free storage
This fix only free()s hsubr when there was *no* error.
--- zsh-2.6-beta10-hzoli10.3/Src/subst.c.orig Wed Aug 16 16:15:45 1995
+++ zsh-2.6-beta10-hzoli10.3/Src/subst.c Wed Aug 16 16:37:07 1995
@@ -1461,5 +1461,4 @@
c = **ptr;
(*ptr)++;
- zsfree(hsubr);
ptr1 = *ptr;
del = *ptr1++;
@@ -1481,4 +1480,5 @@
return;
}
+ zsfree(hsubr);
for (tt = hsubl; *tt; tt++)
if (INULL(*tt))
--
Thorsten Meinecke
<kaefer@xxxxxxxxxxxxxxx>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author