From: Donald Sharp Date: Mon, 28 Nov 2022 13:52:48 +0000 (-0500) Subject: bgpd: Null checking is not needed on failure X-Git-Tag: base_8.5~202^2~4 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=74f3656d12b5a99160aeabea2784514bf22548fa;p=mirror%2Ffrr.git bgpd: Null checking is not needed on failure Memory allocations that fail crash the program. Checking for NULL is not going to do anything. Signed-off-by: Donald Sharp --- diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index 64af8a5411..52f6b64c2c 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -278,8 +278,10 @@ void bgp_mp_list_add(struct list *mp_list, struct bgp_path_info *mpinfo) static struct bgp_path_info_mpath *bgp_path_info_mpath_new(void) { struct bgp_path_info_mpath *new_mpath; + new_mpath = XCALLOC(MTYPE_BGP_MPATH_INFO, sizeof(struct bgp_path_info_mpath)); + return new_mpath; } @@ -313,8 +315,6 @@ bgp_path_info_mpath_get(struct bgp_path_info *path) if (!path->mpath) { mpath = bgp_path_info_mpath_new(); - if (!mpath) - return NULL; path->mpath = mpath; mpath->mp_info = path; }