Mercurial > vim
changeset 28907:8f599b6d9f54 v8.2.4976
patch 8.2.4976: Coverity complains about not restoring a saved value
Commit: https://github.com/vim/vim/commit/b1040dc11fa15818eda724c35a334f460cf98005
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed May 18 11:00:48 2022 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 18 May 2022 12:15:04 +0200 |
parents | d43069214fa6 |
children | 89001c986b21 |
files | src/version.c src/vim9execute.c |
diffstat | 2 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4976, +/**/ 4975, /**/ 4974,
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -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) + 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; - ectx->ec_where.wt_variable = save_wt_variable; if (!ectx->ec_where.wt_variable) ectx->ec_where.wt_index = 0;