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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202107091718.169HIKZx346309%40masaka.moolenaar.net.

Raspunde prin e-mail lui