]> git.puffer.fish Git - mirror/frr.git/commitdiff
*: Do not check for XMALLOC/XCALLOC against NULLs 8942/head
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Tue, 29 Jun 2021 12:18:22 +0000 (15:18 +0300)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Tue, 29 Jun 2021 19:27:50 +0000 (22:27 +0300)
We don't check this pattern anywhere in the code basically, so let's
unify the code.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
bfdd/dplane.c
bgpd/bgpd.c
lib/link_state.c

index 6fb301d46a89a4a6be208f10057c7779b3ec4f8e..4b7f9ba7ace568af64493e1b1b850a8744720ec4 100644 (file)
@@ -651,8 +651,6 @@ static struct bfd_dplane_ctx *bfd_dplane_ctx_new(int sock)
        struct bfd_dplane_ctx *bdc;
 
        bdc = XCALLOC(MTYPE_BFDD_DPLANE_CTX, sizeof(*bdc));
-       if (bdc == NULL)
-               return NULL;
 
        bdc->sock = sock;
        bdc->inbuf = stream_new(BFD_DPLANE_CLIENT_BUF_SIZE);
index b5eebe8259e748ef0966673c18d1840838a80eea..cf38f377b423c52af05ff24d79d14d80ba93e2e5 100644 (file)
@@ -3104,8 +3104,6 @@ static struct bgp *bgp_create(as_t *as, const char *name,
        safi_t safi;
 
        bgp = XCALLOC(MTYPE_BGP, sizeof(struct bgp));
-       if (bgp == NULL)
-               return NULL;
 
        if (BGP_DEBUG(zebra, ZEBRA)) {
                if (inst_type == BGP_INSTANCE_TYPE_DEFAULT)
index e8a6b89f8910a794e5e7436c93ccf1f68d205dc5..062384aac7ab388b8d22d15584a4fd86e6eeffde 100644 (file)
@@ -538,8 +538,6 @@ struct ls_edge *ls_edge_add(struct ls_ted *ted,
 
        /* Create Edge and add it to the TED */
        new = XCALLOC(MTYPE_LS_DB, sizeof(struct ls_edge));
-       if (!new)
-               return NULL;
 
        new->attributes = attributes;
        new->key = key;
@@ -804,8 +802,6 @@ struct ls_ted *ls_ted_new(const uint32_t key, const char *name,
        struct ls_ted *new;
 
        new = XCALLOC(MTYPE_LS_DB, sizeof(struct ls_ted));
-       if (new == NULL)
-               return new;
 
        /* Set basic information for this ted */
        new->key = key;
@@ -1005,8 +1001,6 @@ static struct ls_node *ls_parse_node(struct stream *s)
        size_t len;
 
        node = XCALLOC(MTYPE_LS_DB, sizeof(struct ls_node));
-       if (node == NULL)
-               return NULL;
 
        STREAM_GET(&node->adv, s, sizeof(struct ls_node_id));
        STREAM_GETW(s, node->flags);
@@ -1051,8 +1045,6 @@ static struct ls_attributes *ls_parse_attributes(struct stream *s)
        size_t len;
 
        attr = XCALLOC(MTYPE_LS_DB, sizeof(struct ls_attributes));
-       if (attr == NULL)
-               return NULL;
        attr->srlgs = NULL;
 
        STREAM_GET(&attr->adv, s, sizeof(struct ls_node_id));
@@ -1157,8 +1149,6 @@ static struct ls_prefix *ls_parse_prefix(struct stream *s)
        size_t len;
 
        ls_pref = XCALLOC(MTYPE_LS_DB, sizeof(struct ls_prefix));
-       if (ls_pref == NULL)
-               return NULL;
 
        STREAM_GET(&ls_pref->adv, s, sizeof(struct ls_node_id));
        STREAM_GETW(s, ls_pref->flags);
@@ -1193,8 +1183,6 @@ struct ls_message *ls_parse_msg(struct stream *s)
        struct ls_message *msg;
 
        msg = XCALLOC(MTYPE_LS_DB, sizeof(struct ls_message));
-       if (msg == NULL)
-               return NULL;
 
        /* Read LS Message header */
        STREAM_GETC(s, msg->event);