[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[screen-devel] [PATCH 3/6] Revert "those 0 assignment made rest of code
From: |
Václav Doležal |
Subject: |
[screen-devel] [PATCH 3/6] Revert "those 0 assignment made rest of code totally not working" |
Date: |
Wed, 7 Nov 2018 16:10:29 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 |
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 <address@hidden>
---
src/resize.c | 5 +----
1 file changed, 1 insertion(+), 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++)
--
2.14.5
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [screen-devel] [PATCH 3/6] Revert "those 0 assignment made rest of code totally not working",
Václav Doležal <=