aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/nvim/path.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c637ced90..5d6082b857 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -121,7 +121,7 @@ if(MSVC)
add_definitions(/W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
else()
add_definitions(-Wall -Wextra -pedantic -Wno-unused-parameter
- -Wstrict-prototypes -std=gnu99)
+ -Wstrict-prototypes -Wvla -std=gnu99)
endif()
if(MINGW)
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 45ae12b78a..a9d1d052d4 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -2083,7 +2083,7 @@ static int path_get_absolute_path(const char_u *fname, char_u *buf, int len, int
char_u *p;
*buf = NUL;
- char relative_directory[len];
+ char *relative_directory = xmalloc(len);
char *end_of_path = (char *) fname;
// expand it if forced or not an absolute path
@@ -2105,9 +2105,11 @@ static int path_get_absolute_path(const char_u *fname, char_u *buf, int len, int
}
if (FAIL == path_full_dir_name(relative_directory, (char *) buf, len)) {
+ xfree(relative_directory);
return FAIL;
}
}
+ xfree(relative_directory);
return append_path((char *)buf, end_of_path, len);
}