]> granicus.if.org Git - vim/commitdiff
patch 8.2.4976: Coverity complains about not restoring a saved value v8.2.4976
authorBram Moolenaar <Bram@vim.org>
Wed, 18 May 2022 10:00:48 +0000 (11:00 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 18 May 2022 10:00:48 +0000 (11:00 +0100)
Problem:    Coverity complains about not restoring a saved value.
Solution:   Restore value before handling error.

src/version.c
src/vim9execute.c

index 8d901e4cc42bc38400d6a4dcaa81f48e65f00420..4c63ea0771ad01c0d7c481c37f9ea2c260f66d65 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4976,
 /**/
     4975,
 /**/
index 5050df6c11c31e95a724c1e072db9dfdd15ec61d..a64ae5cbbd8ce6de5011e7c99dc5826521960923 100644 (file)
@@ -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;