diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-06-14 14:58:05 +0200 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2018-08-11 17:14:58 +0200 |
commit | 0ce1ca805d607cec2c0f75dac8950f40e75fc971 (patch) | |
tree | bf34e7a0084ae76089d43ee7f2c4ca8eeed62c8a /ospf6d | |
parent | Merge pull request #2809 from opensourcerouting/routemap-rpki-fix (diff) | |
download | frr-0ce1ca805d607cec2c0f75dac8950f40e75fc971.tar.xz frr-0ce1ca805d607cec2c0f75dac8950f40e75fc971.zip |
*: ALLOC calls cannot fail
There is no need to check for failure of a ALLOC call
as that any failure to do so will result in a assert
happening. So we can safely remove all of this code.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'ospf6d')
-rw-r--r-- | ospf6d/ospf6_interface.c | 6 | ||||
-rw-r--r-- | ospf6d/ospf6_message.c | 8 | ||||
-rw-r--r-- | ospf6d/ospf6_neighbor.c | 4 | ||||
-rw-r--r-- | ospf6d/ospf6_spf.c | 6 |
4 files changed, 0 insertions, 24 deletions
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 9178bf2f6..9777a01ae 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -180,12 +180,6 @@ struct ospf6_interface *ospf6_interface_create(struct interface *ifp) oi = (struct ospf6_interface *)XCALLOC(MTYPE_OSPF6_IF, sizeof(struct ospf6_interface)); - if (!oi) { - zlog_err("Can't malloc ospf6_interface for ifindex %d", - ifp->ifindex); - return (struct ospf6_interface *)NULL; - } - oi->area = (struct ospf6_area *)NULL; oi->neighbor_list = list_new(); oi->neighbor_list->cmp = ospf6_neighbor_cmp; diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index c608a0110..c7cd94bd3 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -1503,14 +1503,6 @@ int ospf6_iobuf_size(unsigned int size) recvnew = XMALLOC(MTYPE_OSPF6_MESSAGE, size); sendnew = XMALLOC(MTYPE_OSPF6_MESSAGE, size); - if (recvnew == NULL || sendnew == NULL) { - if (recvnew) - XFREE(MTYPE_OSPF6_MESSAGE, recvnew); - if (sendnew) - XFREE(MTYPE_OSPF6_MESSAGE, sendnew); - zlog_debug("Could not allocate I/O buffer of size %d.", size); - return iobuflen; - } if (recvbuf) XFREE(MTYPE_OSPF6_MESSAGE, recvbuf); diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index b5a1812ff..0cc7294d6 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -84,10 +84,6 @@ struct ospf6_neighbor *ospf6_neighbor_create(uint32_t router_id, on = (struct ospf6_neighbor *)XMALLOC(MTYPE_OSPF6_NEIGHBOR, sizeof(struct ospf6_neighbor)); - if (on == NULL) { - zlog_warn("neighbor: malloc failed"); - return NULL; - } memset(on, 0, sizeof(struct ospf6_neighbor)); inet_ntop(AF_INET, &router_id, buf, sizeof(buf)); diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 5b6691e6b..69c18ab75 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -1012,16 +1012,10 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area, /* Allocate memory for this LSA */ new_header = XMALLOC(MTYPE_OSPF6_LSA_HEADER, total_lsa_length); - if (!new_header) - return NULL; /* LSA information structure */ lsa = (struct ospf6_lsa *)XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa)); - if (!lsa) { - free(new_header); - return NULL; - } lsa->header = (struct ospf6_lsa_header *)new_header; |