summaryrefslogtreecommitdiff
path: root/ospfd/ospf_opaque.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-06-14 08:58:05 -0400
committerDavid Lamparter <equinox@opensourcerouting.org>2018-08-11 17:14:58 +0200
commit0ce1ca805d607cec2c0f75dac8950f40e75fc971 (patch)
treebf34e7a0084ae76089d43ee7f2c4ca8eeed62c8a /ospfd/ospf_opaque.c
parent1408cdfc07202b2c3e31ad2ef40fae0e8a31e8c0 (diff)
*: 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 'ospfd/ospf_opaque.c')
-rw-r--r--ospfd/ospf_opaque.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c
index 1ae9a29a1b..be62eb3906 100644
--- a/ospfd/ospf_opaque.c
+++ b/ospfd/ospf_opaque.c
@@ -399,13 +399,8 @@ int ospf_register_opaque_functab(
}
}
- if ((new = XCALLOC(MTYPE_OSPF_OPAQUE_FUNCTAB,
- sizeof(struct ospf_opaque_functab)))
- == NULL) {
- zlog_warn("ospf_register_opaque_functab: XMALLOC: %s",
- safe_strerror(errno));
- goto out;
- }
+ new = XCALLOC(MTYPE_OSPF_OPAQUE_FUNCTAB,
+ sizeof(struct ospf_opaque_functab));
new->opaque_type = opaque_type;
new->oipt = NULL;
@@ -554,13 +549,8 @@ register_opaque_info_per_type(struct ospf_opaque_functab *functab,
struct ospf *top;
struct opaque_info_per_type *oipt;
- if ((oipt = XCALLOC(MTYPE_OPAQUE_INFO_PER_TYPE,
- sizeof(struct opaque_info_per_type)))
- == NULL) {
- zlog_warn("register_opaque_info_per_type: XMALLOC: %s",
- safe_strerror(errno));
- goto out;
- }
+ oipt = XCALLOC(MTYPE_OPAQUE_INFO_PER_TYPE,
+ sizeof(struct opaque_info_per_type));
switch (new->data->type) {
case OSPF_OPAQUE_LINK_LSA:
@@ -711,13 +701,9 @@ register_opaque_info_per_id(struct opaque_info_per_type *oipt,
{
struct opaque_info_per_id *oipi;
- if ((oipi = XCALLOC(MTYPE_OPAQUE_INFO_PER_ID,
- sizeof(struct opaque_info_per_id)))
- == NULL) {
- zlog_warn("register_opaque_info_per_id: XMALLOC: %s",
- safe_strerror(errno));
- goto out;
- }
+ oipi = XCALLOC(MTYPE_OPAQUE_INFO_PER_ID,
+ sizeof(struct opaque_info_per_id));
+
oipi->opaque_id = GET_OPAQUE_ID(ntohl(new->data->id.s_addr));
oipi->t_opaque_lsa_self = NULL;
oipi->opqctl_type = oipt;
@@ -725,7 +711,6 @@ register_opaque_info_per_id(struct opaque_info_per_type *oipt,
listnode_add(oipt->id_list, oipi);
-out:
return oipi;
}