diff options
author | Rui Abreu Ferreira <raf-ep@gmx.com> | 2015-09-24 15:01:37 +0100 |
---|---|---|
committer | Rui Abreu Ferreira <raf-ep@gmx.com> | 2015-09-24 16:50:33 +0100 |
commit | e70d6283b6412dd4cafc5566b3672b7a65c6307b (patch) | |
tree | f7b957a5f455b9fd6b9ee4b8e4d04c7c27a21d9d /src | |
parent | ef5ee31452d60bdf3d904f8289ab805f003cffa7 (diff) | |
download | rneovim-e70d6283b6412dd4cafc5566b3672b7a65c6307b.tar.gz rneovim-e70d6283b6412dd4cafc5566b3672b7a65c6307b.tar.bz2 rneovim-e70d6283b6412dd4cafc5566b3672b7a65c6307b.zip |
Remove VLA from path_get_absolute_path
Remove the use of Variable Length Arrays in path_get_absolute_path(), and use
xmalloc/xfree instead.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/path.c | 4 |
1 files changed, 3 insertions, 1 deletions
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); } |