aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-11-29 06:54:56 -0500
committerGitHub <noreply@github.com>2016-11-29 06:54:56 -0500
commit9e56278d0b2882657dc6614197e1cf6aad7bc08f (patch)
tree05bb08eba79569d3bcb621c93902f3fe1290abb2
parent39bb43c5302310081bba1e987e1fcecf74ca6c14 (diff)
parent80b808dbfeb14968561b6bbd2abdc77b522f262c (diff)
downloadrneovim-9e56278d0b2882657dc6614197e1cf6aad7bc08f.tar.gz
rneovim-9e56278d0b2882657dc6614197e1cf6aad7bc08f.tar.bz2
rneovim-9e56278d0b2882657dc6614197e1cf6aad7bc08f.zip
Merge pull request #5684 from jamessan/initialize-terminput-buf
rbuffer: Use xcalloc to ensure memory is initialized
-rw-r--r--src/nvim/rbuffer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/rbuffer.c b/src/nvim/rbuffer.c
index a2cc432eca..111af0d0fb 100644
--- a/src/nvim/rbuffer.c
+++ b/src/nvim/rbuffer.c
@@ -18,7 +18,7 @@ RBuffer *rbuffer_new(size_t capacity)
capacity = 0x10000;
}
- RBuffer *rv = xmalloc(sizeof(RBuffer) + capacity);
+ RBuffer *rv = xcalloc(1, sizeof(RBuffer) + capacity);
rv->full_cb = rv->nonfull_cb = NULL;
rv->data = NULL;
rv->size = 0;
@@ -78,7 +78,7 @@ void rbuffer_reset(RBuffer *buf) FUNC_ATTR_NONNULL_ALL
size_t temp_size;
if ((temp_size = rbuffer_size(buf))) {
if (buf->temp == NULL) {
- buf->temp = xmalloc(rbuffer_capacity(buf));
+ buf->temp = xcalloc(1, rbuffer_capacity(buf));
}
rbuffer_read(buf, buf->temp, buf->size);
}