mirror of
https://github.com/vim/vim.git
synced 2025-07-25 10:54:51 -04:00
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:
parent
b22653a98e
commit
9ba6194d4c
@ -4811,9 +4811,12 @@ f_getchangelist(typval_T *argvars, typval_T *rettv)
|
|||||||
l = list_alloc();
|
l = list_alloc();
|
||||||
if (l == NULL)
|
if (l == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (list_append_list(rettv->vval.v_list, l) == FAIL)
|
if (list_append_list(rettv->vval.v_list, l) == FAIL)
|
||||||
|
{
|
||||||
|
vim_free(l);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The current window change list index tracks only the position for the
|
* The current window change list index tracks only the position for the
|
||||||
* current buffer. For other buffers use the stored index for the current
|
* 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();
|
l = list_alloc();
|
||||||
if (l == NULL)
|
if (l == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (list_append_list(rettv->vval.v_list, l) == FAIL)
|
if (list_append_list(rettv->vval.v_list, l) == FAIL)
|
||||||
|
{
|
||||||
|
vim_free(l);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
list_append_number(rettv->vval.v_list, (varnumber_T)wp->w_jumplistidx);
|
list_append_number(rettv->vval.v_list, (varnumber_T)wp->w_jumplistidx);
|
||||||
|
|
||||||
for (i = 0; i < wp->w_jumplistlen; ++i)
|
for (i = 0; i < wp->w_jumplistlen; ++i)
|
||||||
|
@ -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
|
static void
|
||||||
get_framelayout(frame_T *fr, list_T *l, int outer)
|
get_framelayout(frame_T *fr, list_T *l, int outer)
|
||||||
@ -281,7 +281,11 @@ get_framelayout(frame_T *fr, list_T *l, int outer)
|
|||||||
fr_list = list_alloc();
|
fr_list = list_alloc();
|
||||||
if (fr_list == NULL)
|
if (fr_list == NULL)
|
||||||
return;
|
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)
|
if (fr->fr_layout == FR_LEAF)
|
||||||
@ -300,7 +304,12 @@ get_framelayout(frame_T *fr, list_T *l, int outer)
|
|||||||
win_list = list_alloc();
|
win_list = list_alloc();
|
||||||
if (win_list == NULL)
|
if (win_list == NULL)
|
||||||
return;
|
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;
|
child = fr->fr_child;
|
||||||
while (child != NULL)
|
while (child != NULL)
|
||||||
{
|
{
|
||||||
|
16
src/list.c
16
src/list.c
@ -1076,8 +1076,12 @@ list2items(typval_T *argvars, typval_T *rettv)
|
|||||||
|
|
||||||
if (l2 == NULL)
|
if (l2 == NULL)
|
||||||
break;
|
break;
|
||||||
if (list_append_list(rettv->vval.v_list, l2) == FAIL
|
if (list_append_list(rettv->vval.v_list, l2) == FAIL)
|
||||||
|| list_append_number(l2, idx) == FAIL
|
{
|
||||||
|
vim_free(l2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (list_append_number(l2, idx) == FAIL
|
||||||
|| list_append_tv(l2, &li->li_tv) == FAIL)
|
|| list_append_tv(l2, &li->li_tv) == FAIL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1108,8 +1112,12 @@ string2items(typval_T *argvars, typval_T *rettv)
|
|||||||
l2 = list_alloc();
|
l2 = list_alloc();
|
||||||
if (l2 == NULL)
|
if (l2 == NULL)
|
||||||
break;
|
break;
|
||||||
if (list_append_list(rettv->vval.v_list, l2) == FAIL
|
if (list_append_list(rettv->vval.v_list, l2) == FAIL)
|
||||||
|| list_append_number(l2, idx) == FAIL
|
{
|
||||||
|
vim_free(l2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (list_append_number(l2, idx) == FAIL
|
||||||
|| list_append_string(l2, p, len) == FAIL)
|
|| list_append_string(l2, p, len) == FAIL)
|
||||||
break;
|
break;
|
||||||
p += len;
|
p += len;
|
||||||
|
12
src/search.c
12
src/search.c
@ -4748,8 +4748,7 @@ fuzzy_match_in_list(
|
|||||||
if (items[i].score == SCORE_NONE)
|
if (items[i].score == SCORE_NONE)
|
||||||
break;
|
break;
|
||||||
if (items[i].lmatchpos != NULL
|
if (items[i].lmatchpos != NULL
|
||||||
&& list_append_list(retlist, items[i].lmatchpos)
|
&& list_append_list(retlist, items[i].lmatchpos) == FAIL)
|
||||||
== FAIL)
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4869,17 +4868,26 @@ do_fuzzymatch(typval_T *argvars, typval_T *rettv, int retmatchpos)
|
|||||||
if (l == NULL)
|
if (l == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
if (list_append_list(rettv->vval.v_list, l) == FAIL)
|
if (list_append_list(rettv->vval.v_list, l) == FAIL)
|
||||||
|
{
|
||||||
|
vim_free(l);
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
l = list_alloc();
|
l = list_alloc();
|
||||||
if (l == NULL)
|
if (l == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
if (list_append_list(rettv->vval.v_list, l) == FAIL)
|
if (list_append_list(rettv->vval.v_list, l) == FAIL)
|
||||||
|
{
|
||||||
|
vim_free(l);
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
l = list_alloc();
|
l = list_alloc();
|
||||||
if (l == NULL)
|
if (l == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
if (list_append_list(rettv->vval.v_list, l) == FAIL)
|
if (list_append_list(rettv->vval.v_list, l) == FAIL)
|
||||||
|
{
|
||||||
|
vim_free(l);
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fuzzy_match_in_list(argvars[0].vval.v_list, tv_get_string(&argvars[1]),
|
fuzzy_match_in_list(argvars[0].vval.v_list, tv_get_string(&argvars[1]),
|
||||||
|
@ -707,6 +707,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
338,
|
||||||
/**/
|
/**/
|
||||||
337,
|
337,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user