summaryrefslogtreecommitdiffstats
path: root/history.c
diff options
context:
space:
mode:
Diffstat (limited to 'history.c')
-rw-r--r--history.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/history.c b/history.c
index eb1b936..6fc615e 100644
--- a/history.c
+++ b/history.c
@@ -157,9 +157,10 @@ inputln_addch(struct inputln *line, wchar_t c)
{
int i;
- if (line->len + 1 == line->cap) {
+ if (line->len + 1 >= line->cap) {
line->cap *= 2;
- line->buf = realloc(line->buf, line->cap);
+ line->buf = realloc(line->buf,
+ line->cap * sizeof(wchar_t));
}
for (i = line->len; i > line->cur; i--)