pbrd: Prevent usage of c if it is null

It is possible, that a connected lookup from
zebra_interface_address_read is null.  Protect and Serve

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2019-05-03 20:02:53 -04:00
parent b1ad7351a5
commit 964c3dba62

View File

@ -111,8 +111,9 @@ static int interface_address_add(int command, struct zclient *zclient,
c = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
DEBUGD(&pbr_dbg_zebra,
"%s: %s added %s", __PRETTY_FUNCTION__, c->ifp->name,
prefix2str(c->address, buf, sizeof(buf)));
"%s: %s added %s", __PRETTY_FUNCTION__,
c ? c->ifp->name : "Unknown",
c ? prefix2str(c->address, buf, sizeof(buf)) : "Unknown");
return 0;
}