Skip to content

Commit e0de216

Browse files
committed
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)
1 parent cb908a8 commit e0de216

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/misc2.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4657,7 +4657,10 @@ vim_findfile(void *search_ctx_arg)
46574657
add_pathsep(file_path);
46584658
}
46594659
else
4660+
{
4661+
ff_free_stack_element(stackp);
46604662
goto fail;
4663+
}
46614664
}
46624665

46634666
/* append the fix part of the search path */
@@ -4667,7 +4670,10 @@ vim_findfile(void *search_ctx_arg)
46674670
add_pathsep(file_path);
46684671
}
46694672
else
4673+
{
4674+
ff_free_stack_element(stackp);
46704675
goto fail;
4676+
}
46714677

46724678
#ifdef FEAT_PATH_EXTRA
46734679
rest_of_wildcards = stackp->ffs_wc_path;
@@ -4687,7 +4693,10 @@ vim_findfile(void *search_ctx_arg)
46874693
if (len + 1 < MAXPATHL)
46884694
file_path[len++] = '*';
46894695
else
4696+
{
4697+
ff_free_stack_element(stackp);
46904698
goto fail;
4699+
}
46914700
}
46924701

46934702
if (*p == 0)
@@ -4718,7 +4727,10 @@ vim_findfile(void *search_ctx_arg)
47184727
if (len + 1 < MAXPATHL)
47194728
file_path[len++] = *rest_of_wildcards++;
47204729
else
4730+
{
4731+
ff_free_stack_element(stackp);
47214732
goto fail;
4733+
}
47224734

47234735
file_path[len] = NUL;
47244736
if (vim_ispathsep(*rest_of_wildcards))
@@ -4787,7 +4799,10 @@ vim_findfile(void *search_ctx_arg)
47874799
STRCAT(file_path, search_ctx->ffsc_file_to_search);
47884800
}
47894801
else
4802+
{
4803+
ff_free_stack_element(stackp);
47904804
goto fail;
4805+
}
47914806

47924807
/*
47934808
* Try without extra suffix and then with suffixes

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ static char *(features[]) =
783783

784784
static int included_patches[] =
785785
{ /* Add new patch number below this line */
786+
/**/
787+
843,
786788
/**/
787789
842,
788790
/**/

0 commit comments

Comments
 (0)