diff --git a/src/util/crmessage.c b/src/util/crmessage.c index 942ba2610..d15228510 100644 --- a/src/util/crmessage.c +++ b/src/util/crmessage.c @@ -91,22 +91,21 @@ void crt_register(const struct message_type *mtype) crt = crt->next; } if (!crt) { - int i; crt = malloc(sizeof(crmessage_type)); crt->mtype = mtype; crt->next = crtypes[hash]; crtypes[hash] = crt; if (mtype->nparameters > 0) { + int i; crt->renderers = malloc(sizeof(tostring_f) * mtype->nparameters); + /* can be scrapped for memory vs. speed */ + for (i = 0; i != mtype->nparameters; ++i) { + crt->renderers[i] = tsf_find(mtype->types[i]->name); + } } else { crt->renderers = NULL; } - - /* can be scrapped for memory vs. speed */ - for (i = 0; i != mtype->nparameters; ++i) { - crt->renderers[i] = tsf_find(mtype->types[i]->name); - } } }