Skip to content

Commit

Permalink
patch 9.1.0193: May leak memory in completion when ga_grow() fails
Browse files Browse the repository at this point in the history
Problem:  May leak memory in completion when ga_grow() fails.
Solution: Free "wca" when ga_grow() fails (zeertzjq).

fixes: #14248
closes: #14249

Signed-off-by: zeertzjq <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
  • Loading branch information
zeertzjq authored and chrisbra committed Mar 21, 2024
1 parent 6d1d180 commit 70e566b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/insexpand.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,10 @@ ins_compl_infercase_gettext(
// getting to six bytes from the edge of IObuff switch to using a
// growarray. Add the character in the next round.
if (ga_grow(&gap, IOSIZE) == FAIL)
{
vim_free(wca);
return (char_u *)"[failed]";
}
*p = NUL;
STRCPY(gap.ga_data, IObuff);
gap.ga_len = (int)STRLEN(IObuff);
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
193,
/**/
192,
/**/
Expand Down

0 comments on commit 70e566b

Please sign in to comment.