From 555276b04afa0070f3c0787cde79a09c83d32148 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 15 Feb 2015 13:48:27 +0000 Subject: Ensure line lengths cache is created initialised to zero. --- desktop/textarea.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index ece529e48..573da1d1d 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -934,10 +934,9 @@ static bool textarea_reflow_multiline(struct textarea *ta, assert(ta->flags & TEXTAREA_MULTILINE); if (ta->lines == NULL) { - ta->lines = - malloc(LINE_CHUNK_SIZE * sizeof(struct line_info)); + ta->lines = calloc(sizeof(struct line_info), LINE_CHUNK_SIZE); if (ta->lines == NULL) { - LOG(("malloc failed")); + LOG(("Failed to allocate memory for textarea lines")); return false; } ta->lines_alloc_size = LINE_CHUNK_SIZE; -- cgit v1.2.3