aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/private/helpers.c
diff options
context:
space:
mode:
authorNikolai Aleksandrovich Pavlov <kp-pav@yandex.ru>2017-02-14 02:09:49 +0300
committerJustin M. Keyes <justinkz@gmail.com>2017-02-14 00:09:49 +0100
commit6e881872f45cc6c96897e6157d28a7def7aeadaa (patch)
tree81e4495e3e891466ea6b09d0c9e0371ebaa9b13d /src/nvim/api/private/helpers.c
parent2f38ed11c98a35b7abe53405d8f5f41cb1054f8f (diff)
downloadrneovim-6e881872f45cc6c96897e6157d28a7def7aeadaa.tar.gz
rneovim-6e881872f45cc6c96897e6157d28a7def7aeadaa.tar.bz2
rneovim-6e881872f45cc6c96897e6157d28a7def7aeadaa.zip
api/helpers: Remove NULL dereference (#6109)
Even though all used compilers can swallow this code, it is still undefined behaviour.
Diffstat (limited to 'src/nvim/api/private/helpers.c')
-rw-r--r--src/nvim/api/private/helpers.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 6f3f654bdc..ba4d005e9a 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -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)),
})));
}