Skip to content

Commit

Permalink
patch 8.2.3133: Vim9: memory leak when add() fails
Browse files Browse the repository at this point in the history
Problem:    Vim9: memory leak when add() fails.
Solution:   Allocate listitem_T after type check.
  • Loading branch information
brammool committed Jul 9, 2021
1 parent 6bcb182 commit 90fba56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/list.c
Expand Up @@ -602,11 +602,12 @@ list_append(list_T *l, listitem_T *item)
int
list_append_tv(list_T *l, typval_T *tv)
{
listitem_T *li = listitem_alloc();
listitem_T *li;

if (l->lv_type != NULL && l->lv_type->tt_member != NULL
&& check_typval_arg_type(l->lv_type->tt_member, tv, 0) == FAIL)
return FAIL;
li = listitem_alloc();
if (li == NULL)
return FAIL;
copy_tv(tv, &li->li_tv);
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -755,6 +755,8 @@ static char *(features[]) =

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

0 comments on commit 90fba56

Please sign in to comment.