1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Fix segfaults in terminal resizing, introduced by re-engineering.

[originally from svn r4613]
This commit is contained in:
Simon Tatham 2004-10-13 13:35:29 +00:00
parent 71ad69f897
commit 8f656a37b5

View File

@ -115,8 +115,10 @@ static termline *newline(Terminal *term, int cols, int bce)
static void freeline(termline *line)
{
sfree(line->chars);
sfree(line);
if (line) {
sfree(line->chars);
sfree(line);
}
}
static void unlineptr(termline *line)
@ -1003,7 +1005,7 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines)
{
tree234 *newalt;
termline **newdisp, *line;
int i, j;
int i, j, oldrows = term->rows;
int sblen;
int save_alt_which = term->alt_which;
@ -1105,7 +1107,7 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines)
newdisp[i]->chars[i].attr = ATTR_INVALID;
}
if (term->disptext) {
for (i = 0; i < term->rows; i++)
for (i = 0; i < oldrows; i++)
freeline(term->disptext[i]);
}
sfree(term->disptext);