mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #5684 from jamessan/initialize-terminput-buf
rbuffer: Use xcalloc to ensure memory is initialized
This commit is contained in:
commit
9e56278d0b
@ -18,7 +18,7 @@ RBuffer *rbuffer_new(size_t capacity)
|
|||||||
capacity = 0x10000;
|
capacity = 0x10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
RBuffer *rv = xmalloc(sizeof(RBuffer) + capacity);
|
RBuffer *rv = xcalloc(1, sizeof(RBuffer) + capacity);
|
||||||
rv->full_cb = rv->nonfull_cb = NULL;
|
rv->full_cb = rv->nonfull_cb = NULL;
|
||||||
rv->data = NULL;
|
rv->data = NULL;
|
||||||
rv->size = 0;
|
rv->size = 0;
|
||||||
@ -78,7 +78,7 @@ void rbuffer_reset(RBuffer *buf) FUNC_ATTR_NONNULL_ALL
|
|||||||
size_t temp_size;
|
size_t temp_size;
|
||||||
if ((temp_size = rbuffer_size(buf))) {
|
if ((temp_size = rbuffer_size(buf))) {
|
||||||
if (buf->temp == NULL) {
|
if (buf->temp == NULL) {
|
||||||
buf->temp = xmalloc(rbuffer_capacity(buf));
|
buf->temp = xcalloc(1, rbuffer_capacity(buf));
|
||||||
}
|
}
|
||||||
rbuffer_read(buf, buf->temp, buf->size);
|
rbuffer_read(buf, buf->temp, buf->size);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user