summaryrefslogtreecommitdiff
path: root/lib/libedit
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2019-08-07 04:22:17 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2019-08-07 04:22:17 +0000
commitc38845a75042a4d4ef01a604fcb33250b825fedb (patch)
treeb354e55a31336735de05dc0002aea0fae69f9ac1 /lib/libedit
parentaad45c0f10ec64419d3151b47b7af09a8315095d (diff)
Initialize the line buffer by zero when allocation. This fixes the
problem a crash happens after the window size change. Worked and discussed with asou and schwarze. ok schwarze
Diffstat (limited to 'lib/libedit')
-rw-r--r--lib/libedit/terminal.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libedit/terminal.c b/lib/libedit/terminal.c
index 638997b1083..a2feda87985 100644
--- a/lib/libedit/terminal.c
+++ b/lib/libedit/terminal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: terminal.c,v 1.18 2017/04/12 18:24:37 tb Exp $ */
+/* $OpenBSD: terminal.c,v 1.19 2019/08/07 04:22:16 yasuoka Exp $ */
/* $NetBSD: terminal.c,v 1.17 2016/02/15 15:35:03 christos Exp $ */
/*-
@@ -413,11 +413,11 @@ terminal_alloc_display(EditLine *el)
wchar_t **b;
coord_t *c = &el->el_terminal.t_size;
- b = reallocarray(NULL, c->v + 1, sizeof(*b));
+ b = calloc(c->v + 1, sizeof(*b));
if (b == NULL)
goto done;
for (i = 0; i < c->v; i++) {
- b[i] = reallocarray(NULL, c->h + 1, sizeof(**b));
+ b[i] = calloc(c->h + 1, sizeof(**b));
if (b[i] == NULL) {
while (--i >= 0)
free(b[i]);
@@ -428,11 +428,11 @@ terminal_alloc_display(EditLine *el)
b[c->v] = NULL;
el->el_display = b;
- b = reallocarray(NULL, c->v + 1, sizeof(*b));
+ b = calloc(c->v + 1, sizeof(*b));
if (b == NULL)
goto done;
for (i = 0; i < c->v; i++) {
- b[i] = reallocarray(NULL, c->h + 1, sizeof(**b));
+ b[i] = calloc(c->h + 1, sizeof(**b));
if (b[i] == NULL) {
while (--i >= 0)
free(b[i]);