summaryrefslogtreecommitdiffstats
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-31 11:25:06 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-31 11:25:06 +0100
commit9ba6194d4cba60fec4ed10c33d2d4fbe6e38c696 (patch)
tree908ec5bf5c912a323b8d2412a1f4a68fd410bb03 /src/evalfunc.c
parentb22653a98ed9252b88455c55e15c888c66c97927 (diff)
patch 9.0.0338: return value of list_append_list() not always checkedv9.0.0338
Problem: Return value of list_append_list() not always checked. Solution: Check return value and handle failure.
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index be1b2e71f2..9cbd413405 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -4811,9 +4811,12 @@ f_getchangelist(typval_T *argvars, typval_T *rettv)
l = list_alloc();
if (l == NULL)
return;
-
if (list_append_list(rettv->vval.v_list, l) == FAIL)
+ {
+ vim_free(l);
return;
+ }
+
/*
* The current window change list index tracks only the position for the
* current buffer. For other buffers use the stored index for the current
@@ -5045,9 +5048,12 @@ f_getjumplist(typval_T *argvars, typval_T *rettv)
l = list_alloc();
if (l == NULL)
return;
-
if (list_append_list(rettv->vval.v_list, l) == FAIL)
+ {
+ vim_free(l);
return;
+ }
+
list_append_number(rettv->vval.v_list, (varnumber_T)wp->w_jumplistidx);
for (i = 0; i < wp->w_jumplistlen; ++i)