summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2015-02-15 13:48:27 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2015-02-15 13:48:27 +0000
commit555276b04afa0070f3c0787cde79a09c83d32148 (patch)
tree5057b0a7a4669f645edb536dd8a8537ea8fe041f /desktop
parentb89fb480db3e3cf41ef68e858e24f9cb378e952a (diff)
downloadnetsurf-555276b04afa0070f3c0787cde79a09c83d32148.tar.gz
netsurf-555276b04afa0070f3c0787cde79a09c83d32148.tar.bz2
Ensure line lengths cache is created initialised to zero.
Diffstat (limited to 'desktop')
-rw-r--r--desktop/textarea.c5
1 files 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;