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

@@ -4748,8 +4748,7 @@ fuzzy_match_in_list(
if (items[i].score == SCORE_NONE)
break;
if (items[i].lmatchpos != NULL
&& list_append_list(retlist, items[i].lmatchpos)
== FAIL)
&& list_append_list(retlist, items[i].lmatchpos) == FAIL)
goto done;
}
@@ -4869,17 +4868,26 @@ do_fuzzymatch(typval_T *argvars, typval_T *rettv, int retmatchpos)
if (l == NULL)
goto done;
if (list_append_list(rettv->vval.v_list, l) == FAIL)
{
vim_free(l);
goto done;
}
l = list_alloc();
if (l == NULL)
goto done;
if (list_append_list(rettv->vval.v_list, l) == FAIL)
{
vim_free(l);
goto done;
}
l = list_alloc();
if (l == NULL)
goto done;
if (list_append_list(rettv->vval.v_list, l) == FAIL)
{
vim_free(l);
goto done;
}
}
fuzzy_match_in_list(argvars[0].vval.v_list, tv_get_string(&argvars[1]),