Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: fix a memory leak and potential heap corruption when rotating lines
- X-seq: zsh-workers 44876
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: PATCH: fix a memory leak and potential heap corruption when rotating lines
- Date: Mon, 28 Oct 2019 13:04:02 +0100
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HqFTewfAWXNjFMX8IhdLCmtCdTL5XeL9hp1ydyMy3Bc=; b=QPFYJydoTtE3oR9rZ9y9NQ8grCXC2Afe4l180nLHtFpjz5S/kpJVZYFeXtU9+pJrCf n0Dbxm6e6JZhsekUh0HTXzrwsorqLANce1tkIAdzG5/tRQtMmgniPC2cZ2pZCOXjSczP xKWO57knb0Wkud2ldMPvFgMMw2/KDsN88wS6uQHrJPFNmJ5TQbBzATgje59hV1Tw2g7T KxZuB0K9UZN60KbmtSDLHCAWJXsLWRgRMFMVe/Wwnitei7OofzX+3iTrciu3JPgaWe0w FhSiYyeNYqwlDqzqmiHdJOE4CU5xFIZUswcfGrYM8MG6fmItsAR3IGqom8x0Rh9XBQEh jtqA==
- In-reply-to: <CAHYJk3RoOZj2zNZ1FE7oKNhG=+9nfLw3JFeRm7e2-Tb_EoNctw@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAN=4vMou-FFjD5J0kxs6OLZq-GkUGztOUY-sOt3kL2uXQ_0n2Q@mail.gmail.com> <CAHYJk3RoOZj2zNZ1FE7oKNhG=+9nfLw3JFeRm7e2-Tb_EoNctw@mail.gmail.com>
On Mon, Oct 28, 2019 at 12:50 PM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> Did you accidentally sent a reversed patch?
Oops. Yes, I did.
I'm attaching the proper patch. Link to the same:
https://github.com/zsh-users/zsh/commit/1edb4d235da56e785f85cdc111efdfb9b0753163.
Roman.
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 85e55e0d4..7cc338ab1 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -1652,7 +1652,7 @@ zrefresh(void)
zfree(obuf[iln], (winw + 2) * sizeof(**obuf));
for (t0 = iln; t0 != olnct; t0++)
obuf[t0] = obuf[t0 + 1];
- obuf[--olnct] = NULL;
+ obuf[olnct--] = NULL;
}
/* don't try to insert a line if olnct = vmaxln (vmaxln is the number
of lines that have been displayed by this routine) so that we don't
@@ -1662,6 +1662,7 @@ zrefresh(void)
obuf[iln] && !ZR_strncmp(obuf[iln], nbuf[iln + 1], 16)) {
moveto(iln, 0);
tcout(TCINSLINE);
+ zfree(obuf[olnct], (winw + 2) * sizeof(**obuf));
for (t0 = olnct; t0 != iln; t0--)
obuf[t0] = obuf[t0 - 1];
obuf[iln] = NULL;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author