aboutsummaryrefslogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'st.c')
-rw-r--r--st.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/st.c b/st.c
index b1d3791..bb8c365 100644
--- a/st.c
+++ b/st.c
@@ -2788,8 +2788,11 @@ tresize(int col, int row) {
free(term.line[i]);
free(term.alt[i]);
}
- memmove(term.line, term.line + i, row * sizeof(Line));
- memmove(term.alt, term.alt + i, row * sizeof(Line));
+ /* ensure that both src and dst are not NULL */
+ if (i > 0) {
+ memmove(term.line, term.line + i, row * sizeof(Line));
+ memmove(term.alt, term.alt + i, row * sizeof(Line));
+ }
for(i += row; i < term.row; i++) {
free(term.line[i]);
free(term.alt[i]);
remember that computers suck.