mirror of
https://github.com/vim/vim.git
synced 2026-05-28 00:21:37 +02:00
patch memory leak in list_extend_func() in list.c
Problem: memory leak in list_extend_func() in list.c Solution: Free l1 on early return (Huihui Huang) closes: #19572 Signed-off-by: Huihui Huang <625173@qq.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
123a1e6410
commit
7ed37dc534
+8
-4
@@ -3025,8 +3025,7 @@ list_extend_func(
|
||||
{
|
||||
before = (long)tv_get_number_chk(&argvars[2], &error);
|
||||
if (error)
|
||||
return; // type error; errmsg already given
|
||||
|
||||
goto cleanup; // type error; errmsg already given
|
||||
if (before == l1->lv_len)
|
||||
item = NULL;
|
||||
else
|
||||
@@ -3035,7 +3034,7 @@ list_extend_func(
|
||||
if (item == NULL)
|
||||
{
|
||||
semsg(_(e_list_index_out_of_range_nr), before);
|
||||
return;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3043,7 +3042,7 @@ list_extend_func(
|
||||
item = NULL;
|
||||
if (type != NULL && check_typval_arg_type(
|
||||
type, &argvars[1], func_name, 2) == FAIL)
|
||||
return;
|
||||
goto cleanup;
|
||||
list_extend(l1, l2, item);
|
||||
|
||||
if (is_new)
|
||||
@@ -3054,6 +3053,11 @@ list_extend_func(
|
||||
}
|
||||
else
|
||||
copy_tv(&argvars[0], rettv);
|
||||
return;
|
||||
|
||||
cleanup:
|
||||
if (is_new)
|
||||
list_unref(l1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -734,6 +734,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
121,
|
||||
/**/
|
||||
120,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user