fix: fix incorrect call sites of xcalloc

The number of elements comes first and the size of each element second.
This commit is contained in:
Gregory Anders
2021-07-24 15:49:48 -06:00
parent 46009499af
commit 3fd4f2f611
4 changed files with 10 additions and 10 deletions

View File

@@ -1018,14 +1018,14 @@ static ExtmarkUndoObject *unserialize_extmark(bufinfo_T *bi, bool *error,
extup->type = type;
if (type == kExtmarkSplice) {
n_elems = (size_t)sizeof(ExtmarkSplice) / sizeof(uint8_t);
buf = xcalloc(sizeof(uint8_t), n_elems);
buf = xcalloc(n_elems, sizeof(uint8_t));
if (!undo_read(bi, buf, n_elems)) {
goto error;
}
extup->data.splice = *(ExtmarkSplice *)buf;
} else if (type == kExtmarkMove) {
n_elems = (size_t)sizeof(ExtmarkMove) / sizeof(uint8_t);
buf = xcalloc(sizeof(uint8_t), n_elems);
buf = xcalloc(n_elems, sizeof(uint8_t));
if (!undo_read(bi, buf, n_elems)) {
goto error;
}