Skip to content

Commit

Permalink
patch 8.2.4976: Coverity complains about not restoring a saved value
Browse files Browse the repository at this point in the history
Problem:    Coverity complains about not restoring a saved value.
Solution:   Restore value before handling error.
  • Loading branch information
brammool committed May 18, 2022
1 parent 51f0bfb commit b1040dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -746,6 +746,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4976,
/**/
4975,
/**/
Expand Down
7 changes: 4 additions & 3 deletions src/vim9execute.c
Expand Up @@ -4653,16 +4653,17 @@ exec_instructions(ectx_T *ectx)
{
checktype_T *ct = &iptr->isn_arg.type;
int save_wt_variable = ectx->ec_where.wt_variable;
int r;

tv = STACK_TV_BOT((int)ct->ct_off);
SOURCING_LNUM = iptr->isn_lnum;
if (!ectx->ec_where.wt_variable)
ectx->ec_where.wt_index = ct->ct_arg_idx;
ectx->ec_where.wt_variable = ct->ct_is_var;
if (check_typval_type(ct->ct_type, tv, ectx->ec_where)
== FAIL)
goto on_error;
r = check_typval_type(ct->ct_type, tv, ectx->ec_where);
ectx->ec_where.wt_variable = save_wt_variable;
if (r == FAIL)
goto on_error;
if (!ectx->ec_where.wt_variable)
ectx->ec_where.wt_index = 0;

Expand Down

0 comments on commit b1040dc

Please sign in to comment.