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.
diff --git a/src/search.c b/src/search.c
index 0c2a990..8045bd7 100644
--- a/src/search.c
+++ b/src/search.c
@@ -4748,8 +4748,7 @@
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 @@
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]),