Drop bogus condition from header index allocation

We always allocate the index here as should be obvious from the code,
the condition is a leftover that might've been relevant in the turn
of the millenium but not anymore.

This construct confused clang into thinking there's a NULL pointer
dereference at the end of a long callchain (maybe because the indexlen
argument is signed so if you passed in -1 as indexLen... but fixing
those int32_t's is another story)
This commit is contained in:
Panu Matilainen 2019-06-13 12:23:58 +03:00
parent a9ef23a0d2
commit 2dbf2f2f91
1 changed files with 1 additions and 4 deletions

View File

@ -251,10 +251,7 @@ static Header headerCreate(void *blob, int32_t indexLen)
}
h->instance = 0;
h->sorted = HEADERSORT_NONE;
h->index = (h->indexAlloced
? xcalloc(h->indexAlloced, sizeof(*h->index))
: NULL);
h->index = xcalloc(h->indexAlloced, sizeof(*h->index));
h->nrefs = 0;
return headerLink(h);