CID 22491 FORWARD_NULL

github issue #352
fals positive, rewriting code to appease coverity
This commit is contained in:
Enno Rehling 2015-11-05 11:14:53 +01:00
parent 62d7e9e944
commit 58c1d83c9e

View file

@ -91,23 +91,22 @@ void crt_register(const struct message_type *mtype)
crt = crt->next; crt = crt->next;
} }
if (!crt) { if (!crt) {
int i;
crt = malloc(sizeof(crmessage_type)); crt = malloc(sizeof(crmessage_type));
crt->mtype = mtype; crt->mtype = mtype;
crt->next = crtypes[hash]; crt->next = crtypes[hash];
crtypes[hash] = crt; crtypes[hash] = crt;
if (mtype->nparameters > 0) { if (mtype->nparameters > 0) {
int i;
crt->renderers = malloc(sizeof(tostring_f) * mtype->nparameters); crt->renderers = malloc(sizeof(tostring_f) * mtype->nparameters);
}
else {
crt->renderers = NULL;
}
/* can be scrapped for memory vs. speed */ /* can be scrapped for memory vs. speed */
for (i = 0; i != mtype->nparameters; ++i) { for (i = 0; i != mtype->nparameters; ++i) {
crt->renderers[i] = tsf_find(mtype->types[i]->name); crt->renderers[i] = tsf_find(mtype->types[i]->name);
} }
} }
else {
crt->renderers = NULL;
}
}
} }
int cr_render(const message * msg, char *buffer, const void *userdata) int cr_render(const message * msg, char *buffer, const void *userdata)