0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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)
This commit is contained in:
Bram Moolenaar
2019-01-29 20:17:28 +01:00
parent cb908a813c
commit e0de2164f6
2 changed files with 17 additions and 0 deletions

View File

@@ -4657,8 +4657,11 @@ vim_findfile(void *search_ctx_arg)
add_pathsep(file_path); add_pathsep(file_path);
} }
else else
{
ff_free_stack_element(stackp);
goto fail; goto fail;
} }
}
/* append the fix part of the search path */ /* append the fix part of the search path */
if (STRLEN(file_path) + STRLEN(stackp->ffs_fix_path) + 1 < MAXPATHL) if (STRLEN(file_path) + STRLEN(stackp->ffs_fix_path) + 1 < MAXPATHL)
@@ -4667,7 +4670,10 @@ vim_findfile(void *search_ctx_arg)
add_pathsep(file_path); add_pathsep(file_path);
} }
else else
{
ff_free_stack_element(stackp);
goto fail; goto fail;
}
#ifdef FEAT_PATH_EXTRA #ifdef FEAT_PATH_EXTRA
rest_of_wildcards = stackp->ffs_wc_path; rest_of_wildcards = stackp->ffs_wc_path;
@@ -4687,8 +4693,11 @@ vim_findfile(void *search_ctx_arg)
if (len + 1 < MAXPATHL) if (len + 1 < MAXPATHL)
file_path[len++] = '*'; file_path[len++] = '*';
else else
{
ff_free_stack_element(stackp);
goto fail; goto fail;
} }
}
if (*p == 0) if (*p == 0)
{ {
@@ -4718,7 +4727,10 @@ vim_findfile(void *search_ctx_arg)
if (len + 1 < MAXPATHL) if (len + 1 < MAXPATHL)
file_path[len++] = *rest_of_wildcards++; file_path[len++] = *rest_of_wildcards++;
else else
{
ff_free_stack_element(stackp);
goto fail; goto fail;
}
file_path[len] = NUL; file_path[len] = NUL;
if (vim_ispathsep(*rest_of_wildcards)) 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); STRCAT(file_path, search_ctx->ffsc_file_to_search);
} }
else else
{
ff_free_stack_element(stackp);
goto fail; goto fail;
}
/* /*
* Try without extra suffix and then with suffixes * Try without extra suffix and then with suffixes

View File

@@ -783,6 +783,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
843,
/**/ /**/
842, 842,
/**/ /**/