Revert "those 0 assignment made rest of code totally not working"

This reverts commit ff98d7ff58.

This can potentially cause double-free. `nmlines' and `nhlines'
should be freed in preceding lines.

`nmlines' and `nhlines' are not used in the rest of the function
except in `nomem' label and their valuse are copied into `p', so
their value should be zeroed.

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net
This commit is contained in:
Václav Doležal
2018-11-07 16:10:29 +01:00
committed by Amadeusz Sławiński
parent 82f1ea1cba
commit a47b9801fb

View File

@@ -662,6 +662,7 @@ int ChangeWindowSize(Window *p, int wi, int he, int hi)
if (p->w_hlines && p->w_hlines != nhlines)
free((char *)p->w_hlines);
p->w_hlines = nhlines;
nmlines = nhlines = 0;
/* change tabs */
if (p->w_width != wi) {
@@ -682,10 +683,6 @@ int ChangeWindowSize(Window *p, int wi, int he, int hi)
}
KillWindow(p);
Msg(0, "%s", strnomem);
if (nmlines)
free(nmlines);
if (nhlines)
free(nhlines);
return -1;
}
for (; t < wi; t++)