1
0
forked from aniani/vim

patch 8.2.4976: Coverity complains about not restoring a saved value

Problem:    Coverity complains about not restoring a saved value.
Solution:   Restore value before handling error.
This commit is contained in:
Bram Moolenaar 2022-05-18 11:00:48 +01:00
parent 51f0bfb88a
commit b1040dc11f
2 changed files with 6 additions and 3 deletions

View File

@ -746,6 +746,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 */
/**/
4976,
/**/ /**/
4975, 4975,
/**/ /**/

View File

@ -4653,16 +4653,17 @@ exec_instructions(ectx_T *ectx)
{ {
checktype_T *ct = &iptr->isn_arg.type; checktype_T *ct = &iptr->isn_arg.type;
int save_wt_variable = ectx->ec_where.wt_variable; int save_wt_variable = ectx->ec_where.wt_variable;
int r;
tv = STACK_TV_BOT((int)ct->ct_off); tv = STACK_TV_BOT((int)ct->ct_off);
SOURCING_LNUM = iptr->isn_lnum; SOURCING_LNUM = iptr->isn_lnum;
if (!ectx->ec_where.wt_variable) if (!ectx->ec_where.wt_variable)
ectx->ec_where.wt_index = ct->ct_arg_idx; ectx->ec_where.wt_index = ct->ct_arg_idx;
ectx->ec_where.wt_variable = ct->ct_is_var; ectx->ec_where.wt_variable = ct->ct_is_var;
if (check_typval_type(ct->ct_type, tv, ectx->ec_where) r = check_typval_type(ct->ct_type, tv, ectx->ec_where);
== FAIL)
goto on_error;
ectx->ec_where.wt_variable = save_wt_variable; ectx->ec_where.wt_variable = save_wt_variable;
if (r == FAIL)
goto on_error;
if (!ectx->ec_where.wt_variable) if (!ectx->ec_where.wt_variable)
ectx->ec_where.wt_index = 0; ectx->ec_where.wt_index = 0;