changeset 15671:0a4dfbb312ce v8.1.0843

patch 8.1.0843: memory leak when running "make test_cd" commit https://github.com/vim/vim/commit/e0de2164f62a1736cdc64dbf804b77db8af90c10 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 29 20:17:28 2019 +0100 patch 8.1.0843: memory leak when running "make test_cd" Problem: Memory leak when running "make test_cd". Solution: Free the stack element when failing. (Dominique Pelle, closes #3877)
author Bram Moolenaar <Bram@vim.org>
date Tue, 29 Jan 2019 20:30:14 +0100
parents 6346be214250
children 6a059f8f3f17
files src/misc2.c src/version.c
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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
--- a/src/version.c
+++ b/src/version.c
@@ -784,6 +784,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    843,
+/**/
     842,
 /**/
     841,