diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-09-11 06:40:47 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-09-11 06:40:47 +0000 |
commit | b7a0d50451029b6da867d027694939b94d5d16a7 (patch) | |
tree | 2cfde43fac6d72a4d083ac8e83a213456bc2e766 /usr.bin/tmux/grid.c | |
parent | fe7a66b5ecea7f309448082dbba5a2d2995f55d5 (diff) |
Do not free more lines than are available in the history.
Diffstat (limited to 'usr.bin/tmux/grid.c')
-rw-r--r-- | usr.bin/tmux/grid.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c index f98844259e5..cb9953c72e5 100644 --- a/usr.bin/tmux/grid.c +++ b/usr.bin/tmux/grid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grid.c,v 1.76 2017/09/10 14:36:12 nicm Exp $ */ +/* $OpenBSD: grid.c,v 1.77 2017/09/11 06:40:46 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -292,12 +292,14 @@ grid_collect_history(struct grid *gd) { u_int ny; - if (gd->hsize < gd->hlimit) + if (gd->hsize == 0 || gd->hsize < gd->hlimit) return; ny = gd->hlimit / 10; if (ny < 1) ny = 1; + if (ny > gd->hsize) + ny = gd->hsize; /* * Free the lines from 0 to ny then move the remaining lines over |