changeset 25194:6c75baaa54ee v8.2.3133

patch 8.2.3133: Vim9: memory leak when add() fails Commit: https://github.com/vim/vim/commit/90fba5627b361dbc970b3afc2eebf7411c49a0cc Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jul 9 19:17:55 2021 +0200 patch 8.2.3133: Vim9: memory leak when add() fails Problem: Vim9: memory leak when add() fails. Solution: Allocate listitem_T after type check.
author Bram Moolenaar <Bram@vim.org>
date Fri, 09 Jul 2021 19:30:06 +0200
parents aa10290ecb6f
children f384b79d2eaa
files src/list.c src/version.c
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/list.c
+++ b/src/list.c
@@ -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);
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3133,
+/**/
     3132,
 /**/
     3131,