Ensure line lengths cache is created initialised to zero.

This commit is contained in:
Michael Drake 2015-02-15 13:48:27 +00:00
parent b89fb480db
commit 555276b04a

View File

@ -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;