mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
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 <cb@256bit.org>
This commit is contained in:
parent
42cd192daa
commit
b335a9312c
10
src/eval.c
10
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()"
|
r = tv->vval.v_string == NULL ? (char_u *)"function()"
|
||||||
: make_ufunc_name_readable(tv->vval.v_string,
|
: make_ufunc_name_readable(tv->vval.v_string,
|
||||||
buf, MAX_FUNC_NAME_LEN);
|
buf, MAX_FUNC_NAME_LEN);
|
||||||
if (r == buf)
|
if (r == buf && tv->vval.v_string != NULL)
|
||||||
{
|
{
|
||||||
r = vim_strsave(buf);
|
r = vim_strsave(buf);
|
||||||
*tofree = r;
|
*tofree = r;
|
||||||
@ -6616,7 +6616,9 @@ list_tv2string(
|
|||||||
}
|
}
|
||||||
else
|
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;
|
tv->vval.v_list->lv_copyID = copyID;
|
||||||
*tofree = list2string(tv, copyID, restore_copyID);
|
*tofree = list2string(tv, copyID, restore_copyID);
|
||||||
@ -6658,7 +6660,9 @@ dict_tv2string(
|
|||||||
}
|
}
|
||||||
else
|
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;
|
tv->vval.v_dict->dv_copyID = copyID;
|
||||||
*tofree = dict2string(tv, copyID, restore_copyID);
|
*tofree = dict2string(tv, copyID, restore_copyID);
|
||||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
429,
|
||||||
/**/
|
/**/
|
||||||
428,
|
428,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user