summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2014-05-29 21:10:33 +0000
committeremaste <emaste@FreeBSD.org>2014-05-29 21:10:33 +0000
commit8ef756fbbea701a6ffa6199b91419c97ef168d28 (patch)
tree868a27df5b52b0cd857da6d764fd6006af0da2cf
parent7ca8bf0f2c27a73f51aeaa039bf10ab3c6af198b (diff)
downloadFreeBSD-src-8ef756fbbea701a6ffa6199b91419c97ef168d28.zip
FreeBSD-src-8ef756fbbea701a6ffa6199b91419c97ef168d28.tar.gz
Update size in vt_grow if we don't have to reallocate
vt_grow may be called with a new size that's larger than previous but does not require reallocation - for example, when the number of columns is the same and new number of rows is less than the history size. Prior to this change we would fail to update vb_scr_size, and then hit a KASSERT when trying to write to the newly visible rows. Sponsored by: The FreeBSD Foundation
-rw-r--r--sys/dev/vt/vt_buf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/dev/vt/vt_buf.c b/sys/dev/vt/vt_buf.c
index 7adce98..d8602f8 100644
--- a/sys/dev/vt/vt_buf.c
+++ b/sys/dev/vt/vt_buf.c
@@ -496,6 +496,9 @@ vtbuf_grow(struct vt_buf *vb, const term_pos_t *p, int history_size)
/* Deallocate old buffer. */
free(old, M_VTBUF);
free(oldrows, M_VTBUF);
+ } else {
+ /* Just update the size. */
+ vb->vb_scr_size = *p;
}
}
OpenPOWER on IntegriCloud