mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
api/helpers: Remove NULL dereference (#6109)
Even though all used compilers can swallow this code, it is still undefined behaviour.
This commit is contained in:
parent
2f38ed11c9
commit
6e881872f4
@ -380,7 +380,7 @@ static inline void typval_encode_list_start(EncodedData *const edata,
|
||||
kv_push(edata->stack, ARRAY_OBJ(((Array) {
|
||||
.capacity = len,
|
||||
.size = 0,
|
||||
.items = xmalloc(len * sizeof(*((Object *)NULL)->data.array.items)),
|
||||
.items = xmalloc(len * sizeof(*((Object)OBJECT_INIT).data.array.items)),
|
||||
})));
|
||||
}
|
||||
|
||||
@ -422,7 +422,8 @@ static inline void typval_encode_dict_start(EncodedData *const edata,
|
||||
kv_push(edata->stack, DICTIONARY_OBJ(((Dictionary) {
|
||||
.capacity = len,
|
||||
.size = 0,
|
||||
.items = xmalloc(len * sizeof(*((Object *)NULL)->data.dictionary.items)),
|
||||
.items = xmalloc(len * sizeof(
|
||||
*((Object)OBJECT_INIT).data.dictionary.items)),
|
||||
})));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user