summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVáclav Doležal <vdolezal@redhat.com>2018-11-07 16:10:29 +0100
committerAmadeusz Sławiński <amade@asmblr.net>2018-11-18 16:00:51 +0100
commit10ddd81e20a29a8f543a0422bd49d68ccf772a57 (patch)
tree010102062f9d3b347fbc9e851ccbdb9c70f6142b
parent14db9f00d3a93bf4f8b904993fae892f8d0c3101 (diff)
downloadscreen-10ddd81e20a29a8f543a0422bd49d68ccf772a57.tar.gz
Revert "those 0 assignment made rest of code totally not working"
This reverts commit ff98d7ff5847e07a55b0c40c2ccc3bc430226ca0. 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
-rw-r--r--src/resize.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/resize.c b/src/resize.c
index fc4ddb9..7ed1c93 100644
--- a/src/resize.c
+++ b/src/resize.c
@@ -928,6 +928,7 @@ int wi, he, hi;
free((char *)p->w_hlines);
p->w_hlines = nhlines;
#endif
+ nmlines = nhlines = 0;
/* change tabs */
if (p->w_width != wi)
@@ -955,10 +956,6 @@ int wi, he, hi;
}
KillWindow(p);
Msg(0, "%s", strnomem);
- if (nmlines)
- free(nmlines);
- if (nhlines)
- free(nhlines);
return -1;
}
for (; t < wi; t++)