Skip to content

Commit 90fba56

Browse files
committed
patch 8.2.3133: Vim9: memory leak when add() fails
Problem: Vim9: memory leak when add() fails. Solution: Allocate listitem_T after type check.
1 parent 6bcb182 commit 90fba56

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/list.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,11 +602,12 @@ list_append(list_T *l, listitem_T *item)
602602
int
603603
list_append_tv(list_T *l, typval_T *tv)
604604
{
605-
listitem_T *li = listitem_alloc();
605+
listitem_T *li;
606606

607607
if (l->lv_type != NULL && l->lv_type->tt_member != NULL
608608
&& check_typval_arg_type(l->lv_type->tt_member, tv, 0) == FAIL)
609609
return FAIL;
610+
li = listitem_alloc();
610611
if (li == NULL)
611612
return FAIL;
612613
copy_tv(tv, &li->li_tv);

src/version.c

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

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3133,
758760
/**/
759761
3132,
760762
/**/

0 commit comments

Comments
 (0)