Mercurial > vim
diff src/evalwindow.c @ 30001:6c1a9d7a931f v9.0.0338
patch 9.0.0338: return value of list_append_list() not always checked
Commit: https://github.com/vim/vim/commit/9ba6194d4cba60fec4ed10c33d2d4fbe6e38c696
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 31 11:25:06 2022 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 31 Aug 2022 12:30:06 +0200 |
parents | 86eb4aba16c3 |
children | 101f08b49ed3 |
line wrap: on
line diff
--- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -261,7 +261,7 @@ find_tabwin( } /* - * 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 @@ get_framelayout(frame_T *fr, list_T *l, 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 @@ get_framelayout(frame_T *fr, list_T *l, 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) {