0
0
mirror of https://github.com/vim/vim.git synced 2025-09-06 21:53:38 -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:
Bram Moolenaar 2022-09-10 10:42:20 +01:00
parent 6de2296e5e
commit 12553ada3b
2 changed files with 9 additions and 3 deletions

View File

@ -1121,6 +1121,8 @@ get_lval(
var2.v_type = VAR_UNKNOWN;
while (*p == '[' || (*p == '.' && p[1] != '=' && p[1] != '.'))
{
int r;
if (*p == '.' && lp->ll_tv->v_type != VAR_DICT)
{
if (!quiet)
@ -1136,12 +1138,14 @@ get_lval(
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)
rettv_list_alloc(lp->ll_tv);
r = rettv_list_alloc(lp->ll_tv);
else if (lp->ll_tv->v_type == VAR_BLOB
&& 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)
{

View File

@ -703,6 +703,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
433,
/**/
432,
/**/