forked from aniani/vim
patch 8.2.1087: possible memory leak when file expansion fails
Problem: Possible memory leak when file expansion fails. Solution: Clear the grow array when returning FAIL. Use an error message instead of an empty string.
This commit is contained in:
@@ -3813,8 +3813,13 @@ gen_expand_wildcards(
|
|||||||
vim_free(p);
|
vim_free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When returning FAIL the array must be freed here.
|
||||||
|
if (retval == FAIL)
|
||||||
|
ga_clear(&ga);
|
||||||
|
|
||||||
*num_file = ga.ga_len;
|
*num_file = ga.ga_len;
|
||||||
*file = (ga.ga_data != NULL) ? (char_u **)ga.ga_data : (char_u **)"";
|
*file = (ga.ga_data != NULL) ? (char_u **)ga.ga_data
|
||||||
|
: (char_u **)_("no matches");
|
||||||
|
|
||||||
recursive = FALSE;
|
recursive = FALSE;
|
||||||
|
|
||||||
|
@@ -754,6 +754,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 */
|
||||||
|
/**/
|
||||||
|
1087,
|
||||||
/**/
|
/**/
|
||||||
1086,
|
1086,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user