Skip to content

Commit b335a93

Browse files
committed
patch 9.1.0429: Coverity complains about eval.c refactor
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 <[email protected]>
1 parent 42cd192 commit b335a93

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/eval.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6499,7 +6499,7 @@ func_tv2string(typval_T *tv, char_u **tofree, int echo_style)
64996499
r = tv->vval.v_string == NULL ? (char_u *)"function()"
65006500
: make_ufunc_name_readable(tv->vval.v_string,
65016501
buf, MAX_FUNC_NAME_LEN);
6502-
if (r == buf)
6502+
if (r == buf && tv->vval.v_string != NULL)
65036503
{
65046504
r = vim_strsave(buf);
65056505
*tofree = r;
@@ -6616,7 +6616,9 @@ list_tv2string(
66166616
}
66176617
else
66186618
{
6619-
int old_copyID = tv->vval.v_list->lv_copyID;
6619+
int old_copyID;
6620+
if (restore_copyID)
6621+
old_copyID = tv->vval.v_list->lv_copyID;
66206622

66216623
tv->vval.v_list->lv_copyID = copyID;
66226624
*tofree = list2string(tv, copyID, restore_copyID);
@@ -6658,7 +6660,9 @@ dict_tv2string(
66586660
}
66596661
else
66606662
{
6661-
int old_copyID = tv->vval.v_dict->dv_copyID;
6663+
int old_copyID;
6664+
if (restore_copyID)
6665+
old_copyID = tv->vval.v_dict->dv_copyID;
66626666

66636667
tv->vval.v_dict->dv_copyID = copyID;
66646668
*tofree = dict2string(tv, copyID, restore_copyID);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
429,
707709
/**/
708710
428,
709711
/**/

0 commit comments

Comments
 (0)