aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2015-02-20 17:32:42 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2015-03-22 11:31:47 +0100
commit3db0a40d691c103a26ef3df74528f12d89b0fa61 (patch)
treecd5c52d3a93783163ea70ba718f6c8d72a3fb961
parentfb44a233a5be72d8d1cfd02e300db7de2b4bf428 (diff)
downloadrneovim-3db0a40d691c103a26ef3df74528f12d89b0fa61.tar.gz
rneovim-3db0a40d691c103a26ef3df74528f12d89b0fa61.tar.bz2
rneovim-3db0a40d691c103a26ef3df74528f12d89b0fa61.zip
coverity/105568: Free of array-typed value: FP.
Problem : Free of array-typed value @ 3628. Diagnostic : False positive. Rationale : expand_shell_cmd() is called with a mock value for file (*file = (char_u **)""). That means we want file to be filled with a new value. We can't use *file = NULL because that means we don't want file to be filled. Now, coverity incorrectly thinks that sentinel value is the one we are freeing up at some other later point, which is not the case. Resolution : Assert that, when we are freeing *file, its value is different than the sentinel one.
-rw-r--r--src/nvim/ex_getln.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index d5f7a218f4..238beebf3e 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -10,6 +10,7 @@
* ex_getln.c: Functions for entering and editing an Ex command line.
*/
+#include <assert.h>
#include <errno.h>
#include <stdbool.h>
#include <string.h>
@@ -3858,8 +3859,10 @@ expand_shellcmd (
STRLCPY(buf + l, pat, MAXPATHL - l);
/* Expand matches in one directory of $PATH. */
+ char_u **prev_file = *file;
ret = expand_wildcards(1, &buf, num_file, file, flags);
if (ret == OK) {
+ assert(*file != prev_file);
ga_grow(&ga, *num_file);
{
for (i = 0; i < *num_file; ++i) {