1
0
forked from aniani/vim

patch 9.0.0338: return value of list_append_list() not always checked

Problem:    Return value of list_append_list() not always checked.
Solution:   Check return value and handle failure.
This commit is contained in:
Bram Moolenaar
2022-08-31 11:25:06 +01:00
parent b22653a98e
commit 9ba6194d4c
5 changed files with 44 additions and 11 deletions

View File

@@ -1076,8 +1076,12 @@ list2items(typval_T *argvars, typval_T *rettv)
if (l2 == NULL)
break;
if (list_append_list(rettv->vval.v_list, l2) == FAIL
|| list_append_number(l2, idx) == FAIL
if (list_append_list(rettv->vval.v_list, l2) == FAIL)
{
vim_free(l2);
break;
}
if (list_append_number(l2, idx) == FAIL
|| list_append_tv(l2, &li->li_tv) == FAIL)
break;
}
@@ -1108,8 +1112,12 @@ string2items(typval_T *argvars, typval_T *rettv)
l2 = list_alloc();
if (l2 == NULL)
break;
if (list_append_list(rettv->vval.v_list, l2) == FAIL
|| list_append_number(l2, idx) == FAIL
if (list_append_list(rettv->vval.v_list, l2) == FAIL)
{
vim_free(l2);
break;
}
if (list_append_number(l2, idx) == FAIL
|| list_append_string(l2, p, len) == FAIL)
break;
p += len;