mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05:00
Fix segfaults in terminal resizing, introduced by re-engineering.
[originally from svn r4613]
This commit is contained in:
parent
71ad69f897
commit
8f656a37b5
10
terminal.c
10
terminal.c
@ -115,8 +115,10 @@ static termline *newline(Terminal *term, int cols, int bce)
|
|||||||
|
|
||||||
static void freeline(termline *line)
|
static void freeline(termline *line)
|
||||||
{
|
{
|
||||||
sfree(line->chars);
|
if (line) {
|
||||||
sfree(line);
|
sfree(line->chars);
|
||||||
|
sfree(line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unlineptr(termline *line)
|
static void unlineptr(termline *line)
|
||||||
@ -1003,7 +1005,7 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines)
|
|||||||
{
|
{
|
||||||
tree234 *newalt;
|
tree234 *newalt;
|
||||||
termline **newdisp, *line;
|
termline **newdisp, *line;
|
||||||
int i, j;
|
int i, j, oldrows = term->rows;
|
||||||
int sblen;
|
int sblen;
|
||||||
int save_alt_which = term->alt_which;
|
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;
|
newdisp[i]->chars[i].attr = ATTR_INVALID;
|
||||||
}
|
}
|
||||||
if (term->disptext) {
|
if (term->disptext) {
|
||||||
for (i = 0; i < term->rows; i++)
|
for (i = 0; i < oldrows; i++)
|
||||||
freeline(term->disptext[i]);
|
freeline(term->disptext[i]);
|
||||||
}
|
}
|
||||||
sfree(term->disptext);
|
sfree(term->disptext);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user