From 3116f870ba274862fa6d6643d9fa0870215fed12 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 29 Mar 2017 16:30:06 -0400 Subject: [PATCH] coverity/161195: Increase scope of exe_name Since exe_name is a stack allocated array, we need it to be in scope for the lifetime that vim_path points to it. --- src/nvim/os/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index a73d753e46..a10c835591 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -615,9 +615,9 @@ char *vim_getenv(const char *name) vim_path = (char *)p_hf; } + char exe_name[MAXPATHL]; // Find runtime path relative to the nvim binary: ../share/nvim/runtime if (vim_path == NULL) { - char exe_name[MAXPATHL]; size_t exe_name_len = MAXPATHL; if (os_exepath(exe_name, &exe_name_len) == 0) { char *path_end = (char *)path_tail_with_sep((char_u *)exe_name);