summaryrefslogtreecommitdiffstats
path: root/src/filepath.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-23 18:18:52 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-23 18:18:52 +0100
commit70188f5b23ea7efec7adaf74e0af797d1bb1afe8 (patch)
treeb15dd47af8727d1b9a68351abdc4bc68a587a078 /src/filepath.c
parent7c77b3496710f1be3232cfdc7f6812347fbd914a (diff)
patch 8.2.0034: missing check for out of memoryv8.2.0034
Problem: Missing check for out of memory. Solution: Check for NULL after vim_strsave(). (Dominique Pelle, closes #5393)
Diffstat (limited to 'src/filepath.c')
-rw-r--r--src/filepath.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/filepath.c b/src/filepath.c
index 01d2dcb97b..ef5edae234 100644
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -1658,7 +1658,8 @@ f_resolve(typval_T *argvars, typval_T *rettv)
int limit = 100;
p = vim_strsave(p);
-
+ if (p == NULL)
+ goto fail;
if (p[0] == '.' && (vim_ispathsep(p[1])
|| (p[1] == '.' && (vim_ispathsep(p[2])))))
is_relative_to_current = TRUE;
@@ -1681,7 +1682,10 @@ f_resolve(typval_T *argvars, typval_T *rettv)
buf = alloc(MAXPATHL + 1);
if (buf == NULL)
+ {
+ vim_free(p);
goto fail;
+ }
for (;;)
{