From 2393074d5f8af1983f5ce0de0b1d5567ad6ae309 Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Tue, 5 May 2015 21:32:23 +1200 Subject: [PATCH 1/2] coverity/109019: fixing "Sizeof not portable" suspicious_sizeof: Passing argument 8UL /* sizeof (char const **) */ to function xcalloc and then casting the return value to char ** is suspicious. In this particular case sizeof (char const **) happens to be equal to sizeof (char const *), but this is not a portable as --- src/nvim/msgpack_rpc/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/msgpack_rpc/server.c b/src/nvim/msgpack_rpc/server.c index 5e3fd100da..7f7291c3b9 100644 --- a/src/nvim/msgpack_rpc/server.c +++ b/src/nvim/msgpack_rpc/server.c @@ -268,7 +268,7 @@ char **server_address_list(size_t *size) return NULL; } - char **addrs = xcalloc((size_t) servers.ga_len, sizeof(const char **)); + char **addrs = xcalloc((size_t) servers.ga_len, sizeof(const char *)); for (int i = 0; i < servers.ga_len; i++) { addrs[i] = xstrdup(((Server **)servers.ga_data)[i]->addr); } From 7fc7147ad6c3ab5b1523e3014ad92d2d653bcb84 Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Tue, 5 May 2015 22:02:18 +1200 Subject: [PATCH 2/2] coverity/62618: fixing "Wrong sizeof argument" suspicious_sizeof: Passing argument 168UL /* sizeof (ufunc_T) */ * todo to function xmalloc and then casting the return value to ufunc_T ** is suspicious. --- src/nvim/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 8a98eae21f..d6b1960155 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -18575,7 +18575,7 @@ void func_dump_profile(FILE *fd) if (todo == 0) return; /* nothing to dump */ - sorttab = xmalloc(sizeof(ufunc_T) * todo); + sorttab = xmalloc(sizeof(ufunc_T *) * todo); for (hi = func_hashtab.ht_array; todo > 0; ++hi) { if (!HASHITEM_EMPTY(hi)) {