diff options
author | Christian Brabandt <cb@256bit.org> | 2024-05-21 18:39:10 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-05-21 18:39:10 +0200 |
commit | b335a9312cfbe5a5fa9186d06fe10479502ba15c (patch) | |
tree | 2ed5305eda1823314f382f15fa3377707983b09b | |
parent | 42cd192daa4b7f29131c7be1beaecb6067e96266 (diff) |
patch 9.1.0429: Coverity complains about eval.c refactorv9.1.0429
Problem: Coverity complains about eval.c refactor
(after v9.1.0422)
Solution: Check that buf is not used un-initialized,
add explicit conditions for save and restore
of copyID
Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r-- | src/eval.c | 10 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c index 833a230f9d..9a20645531 100644 --- a/src/eval.c +++ b/src/eval.c @@ -6499,7 +6499,7 @@ func_tv2string(typval_T *tv, char_u **tofree, int echo_style) r = tv->vval.v_string == NULL ? (char_u *)"function()" : make_ufunc_name_readable(tv->vval.v_string, buf, MAX_FUNC_NAME_LEN); - if (r == buf) + if (r == buf && tv->vval.v_string != NULL) { r = vim_strsave(buf); *tofree = r; @@ -6616,7 +6616,9 @@ list_tv2string( } else { - int old_copyID = tv->vval.v_list->lv_copyID; + int old_copyID; + if (restore_copyID) + old_copyID = tv->vval.v_list->lv_copyID; tv->vval.v_list->lv_copyID = copyID; *tofree = list2string(tv, copyID, restore_copyID); @@ -6658,7 +6660,9 @@ dict_tv2string( } else { - int old_copyID = tv->vval.v_dict->dv_copyID; + int old_copyID; + if (restore_copyID) + old_copyID = tv->vval.v_dict->dv_copyID; tv->vval.v_dict->dv_copyID = copyID; *tofree = dict2string(tv, copyID, restore_copyID); diff --git a/src/version.c b/src/version.c index acec967b8f..b2f04169fd 100644 --- a/src/version.c +++ b/src/version.c @@ -705,6 +705,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 429, +/**/ 428, /**/ 427, |