]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Null checking is not needed on failure
authorDonald Sharp <sharpd@nvidia.com>
Mon, 28 Nov 2022 13:52:48 +0000 (08:52 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 28 Nov 2022 13:52:48 +0000 (08:52 -0500)
Memory allocations that fail crash the program.  Checking
for NULL is not going to do anything.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_mpath.c

index 64af8a541161ddc7988bb25929f910fa88cc69b2..52f6b64c2c96fec54a85ea094a4c00765ae3dc6d 100644 (file)
@@ -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;
        }