bgpd: rfapi xcallocs guaranteed non-null

The return value of XCALLOC will always be non-null. Even if it were to
be null, this code would still crash with a NPD.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2018-04-11 14:14:06 -04:00
parent 039c1e8d4f
commit 316f27e169

View File

@ -548,13 +548,12 @@ rfapi_group_new(struct bgp *bgp, rfapi_group_cfg_type_t type, const char *name)
rfg = XCALLOC(MTYPE_RFAPI_GROUP_CFG,
sizeof(struct rfapi_nve_group_cfg));
if (rfg) {
rfg->type = type;
rfg->name = strdup(name);
/* add to tail of list */
listnode_add(bgp->rfapi_cfg->nve_groups_sequential, rfg);
}
rfg->type = type;
rfg->name = strdup(name);
/* add to tail of list */
listnode_add(bgp->rfapi_cfg->nve_groups_sequential, rfg);
rfg->label = MPLS_LABEL_NONE;
QOBJ_REG(rfg, rfapi_nve_group_cfg);
return rfg;