Patch 8.2.3133
Problem: Vim9: memory leak when add() fails.
Solution: Allocate listitem_T after type check.
Files: src/list.c
*** ../vim-8.2.3132/src/list.c 2021-07-08 20:53:36.866676082 +0200
--- src/list.c 2021-07-09 19:15:59.482164280 +0200
***************
*** 602,612 ****
int
list_append_tv(list_T *l, typval_T *tv)
{
! listitem_T *li = listitem_alloc();
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;
if (li == NULL)
return FAIL;
copy_tv(tv, &li->li_tv);
--- 602,613 ----
int
list_append_tv(list_T *l, typval_T *tv)
{
! 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);
*** ../vim-8.2.3132/src/version.c 2021-07-09 15:53:57.220856706 +0200
--- src/version.c 2021-07-09 19:16:38.058109624 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3133,
/**/
--
A meeting is an event at which the minutes are kept and the hours are lost.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///