diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-01-29 20:17:28 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-01-29 20:17:28 +0100 |
commit | e0de2164f62a1736cdc64dbf804b77db8af90c10 (patch) | |
tree | 17971f1441d03a0743ae71d57dbdb619bd640e47 /src/misc2.c | |
parent | cb908a813cebf7fb4608ff43fc3d258cf2768809 (diff) | |
download | vim-git-8.1.0843.tar.gz |
patch 8.1.0843: memory leak when running "make test_cd"v8.1.0843
Problem: Memory leak when running "make test_cd".
Solution: Free the stack element when failing. (Dominique Pelle,
closes #3877)
Diffstat (limited to 'src/misc2.c')
-rw-r--r-- | src/misc2.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/misc2.c b/src/misc2.c index ca8f56d38..df3f8e169 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -4657,7 +4657,10 @@ vim_findfile(void *search_ctx_arg) add_pathsep(file_path); } else + { + ff_free_stack_element(stackp); goto fail; + } } /* append the fix part of the search path */ @@ -4667,7 +4670,10 @@ vim_findfile(void *search_ctx_arg) add_pathsep(file_path); } else + { + ff_free_stack_element(stackp); goto fail; + } #ifdef FEAT_PATH_EXTRA rest_of_wildcards = stackp->ffs_wc_path; @@ -4687,7 +4693,10 @@ vim_findfile(void *search_ctx_arg) if (len + 1 < MAXPATHL) file_path[len++] = '*'; else + { + ff_free_stack_element(stackp); goto fail; + } } if (*p == 0) @@ -4718,7 +4727,10 @@ vim_findfile(void *search_ctx_arg) if (len + 1 < MAXPATHL) file_path[len++] = *rest_of_wildcards++; else + { + ff_free_stack_element(stackp); goto fail; + } file_path[len] = NUL; if (vim_ispathsep(*rest_of_wildcards)) @@ -4787,7 +4799,10 @@ vim_findfile(void *search_ctx_arg) STRCAT(file_path, search_ctx->ffsc_file_to_search); } else + { + ff_free_stack_element(stackp); goto fail; + } /* * Try without extra suffix and then with suffixes |