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/evalwindow.c b/src/evalwindow.c
index 906c269..7a01962 100644
--- a/src/evalwindow.c
+++ b/src/evalwindow.c
@@ -261,7 +261,7 @@
}
/*
- * Get the layout of the given tab page for winlayout().
+ * Get the layout of the given tab page for winlayout() and add it to "l".
*/
static void
get_framelayout(frame_T *fr, list_T *l, int outer)
@@ -281,7 +281,11 @@
fr_list = list_alloc();
if (fr_list == NULL)
return;
- list_append_list(l, fr_list);
+ if (list_append_list(l, fr_list) == FAIL)
+ {
+ vim_free(fr_list);
+ return;
+ }
}
if (fr->fr_layout == FR_LEAF)
@@ -300,7 +304,12 @@
win_list = list_alloc();
if (win_list == NULL)
return;
- list_append_list(fr_list, win_list);
+ if (list_append_list(fr_list, win_list) == FAIL)
+ {
+ vim_free(win_list);
+ return;
+ }
+
child = fr->fr_child;
while (child != NULL)
{