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.
This commit is contained in:
James McCoy 2017-03-29 16:30:06 -04:00
parent 6964b67c00
commit 3116f870ba
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB

View File

@ -615,9 +615,9 @@ char *vim_getenv(const char *name)
vim_path = (char *)p_hf; vim_path = (char *)p_hf;
} }
char exe_name[MAXPATHL];
// Find runtime path relative to the nvim binary: ../share/nvim/runtime // Find runtime path relative to the nvim binary: ../share/nvim/runtime
if (vim_path == NULL) { if (vim_path == NULL) {
char exe_name[MAXPATHL];
size_t exe_name_len = MAXPATHL; size_t exe_name_len = MAXPATHL;
if (os_exepath(exe_name, &exe_name_len) == 0) { if (os_exepath(exe_name, &exe_name_len) == 0) {
char *path_end = (char *)path_tail_with_sep((char_u *)exe_name); char *path_end = (char *)path_tail_with_sep((char_u *)exe_name);