Skip to content

Commit 12553ad

Browse files
committed
patch 9.0.0433: Coverity warns for not checking allocation failure
Problem: Coverity warns for not checking allocation failure. Solution: Check that allocating a list or blob succeeded.
1 parent 6de2296 commit 12553ad

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
@@ -1121,6 +1121,8 @@ get_lval(
11211121
var2.v_type = VAR_UNKNOWN;
11221122
while (*p == '[' || (*p == '.' && p[1] != '=' && p[1] != '.'))
11231123
{
1124+
int r;
1125+
11241126
if (*p == '.' && lp->ll_tv->v_type != VAR_DICT)
11251127
{
11261128
if (!quiet)
@@ -1136,12 +1138,14 @@ get_lval(
11361138
return NULL;
11371139
}
11381140

1139-
// a NULL list/blob works like an empty list/blob, allocate one now.
1141+
// A NULL list/blob works like an empty list/blob, allocate one now.
11401142
if (lp->ll_tv->v_type == VAR_LIST && lp->ll_tv->vval.v_list == NULL)
1141-
rettv_list_alloc(lp->ll_tv);
1143+
r = rettv_list_alloc(lp->ll_tv);
11421144
else if (lp->ll_tv->v_type == VAR_BLOB
11431145
&& lp->ll_tv->vval.v_blob == NULL)
1144-
rettv_blob_alloc(lp->ll_tv);
1146+
r = rettv_blob_alloc(lp->ll_tv);
1147+
if (r == FAIL)
1148+
return NULL;
11451149

11461150
if (lp->ll_range)
11471151
{

src/version.c

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

704704
static int included_patches[] =
705705
{ /* Add new patch number below this line */
706+
/**/
707+
433,
706708
/**/
707709
432,
708710
/**/

0 commit comments

Comments
 (0)