mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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.
This commit is contained in:
10
src/eval.c
10
src/eval.c
@@ -1121,6 +1121,8 @@ get_lval(
|
|||||||
var2.v_type = VAR_UNKNOWN;
|
var2.v_type = VAR_UNKNOWN;
|
||||||
while (*p == '[' || (*p == '.' && p[1] != '=' && p[1] != '.'))
|
while (*p == '[' || (*p == '.' && p[1] != '=' && p[1] != '.'))
|
||||||
{
|
{
|
||||||
|
int r;
|
||||||
|
|
||||||
if (*p == '.' && lp->ll_tv->v_type != VAR_DICT)
|
if (*p == '.' && lp->ll_tv->v_type != VAR_DICT)
|
||||||
{
|
{
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
@@ -1136,12 +1138,14 @@ get_lval(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// a NULL list/blob works like an empty list/blob, allocate one now.
|
// A NULL list/blob works like an empty list/blob, allocate one now.
|
||||||
if (lp->ll_tv->v_type == VAR_LIST && lp->ll_tv->vval.v_list == NULL)
|
if (lp->ll_tv->v_type == VAR_LIST && lp->ll_tv->vval.v_list == NULL)
|
||||||
rettv_list_alloc(lp->ll_tv);
|
r = rettv_list_alloc(lp->ll_tv);
|
||||||
else if (lp->ll_tv->v_type == VAR_BLOB
|
else if (lp->ll_tv->v_type == VAR_BLOB
|
||||||
&& lp->ll_tv->vval.v_blob == NULL)
|
&& lp->ll_tv->vval.v_blob == NULL)
|
||||||
rettv_blob_alloc(lp->ll_tv);
|
r = rettv_blob_alloc(lp->ll_tv);
|
||||||
|
if (r == FAIL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (lp->ll_range)
|
if (lp->ll_range)
|
||||||
{
|
{
|
||||||
|
@@ -703,6 +703,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 */
|
||||||
|
/**/
|
||||||
|
433,
|
||||||
/**/
|
/**/
|
||||||
432,
|
432,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user