mirror of git://git.suckless.org/st
Fix memmove() invocation with src/dst being NULL
This fixes a segmentation fault on some systems.
This commit is contained in:
parent
aff35af275
commit
56abffb4b6
3
st.c
3
st.c
|
@ -2788,8 +2788,11 @@ tresize(int col, int row) {
|
||||||
free(term.line[i]);
|
free(term.line[i]);
|
||||||
free(term.alt[i]);
|
free(term.alt[i]);
|
||||||
}
|
}
|
||||||
|
/* ensure that both src and dst are not NULL */
|
||||||
|
if (i > 0) {
|
||||||
memmove(term.line, term.line + i, row * sizeof(Line));
|
memmove(term.line, term.line + i, row * sizeof(Line));
|
||||||
memmove(term.alt, term.alt + i, row * sizeof(Line));
|
memmove(term.alt, term.alt + i, row * sizeof(Line));
|
||||||
|
}
|
||||||
for(i += row; i < term.row; i++) {
|
for(i += row; i < term.row; i++) {
|
||||||
free(term.line[i]);
|
free(term.line[i]);
|
||||||
free(term.alt[i]);
|
free(term.alt[i]);
|
||||||
|
|
Loading…
Reference in New Issue