From 5b3d4186defcf9faa15fce45703ee8c5a80f74db Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 20 Aug 2018 20:41:37 -0400 Subject: ospfd: Add ospf_lsa_new_and_data function and abstract away In all but one instance we were following this pattern with ospf_lsa_new: ospf_lsa_new() ospf_lsa_data_new() so let's create a ospf_lsa_new_and_data to abstract this bit of fun and cleanup all the places where it assumes these function calls can fail. Signed-off-by: Donald Sharp --- ospfd/ospf_te.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'ospfd/ospf_te.c') diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index cc2d9282f..a9dc1c18e 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -1201,18 +1201,7 @@ static struct ospf_lsa *ospf_mpls_te_lsa_new(struct ospf *ospf, lsah->length = htons(length); /* Now, create an OSPF LSA instance. */ - if ((new = ospf_lsa_new()) == NULL) { - zlog_warn("%s: ospf_lsa_new() ?", __func__); - stream_free(s); - return NULL; - } - if ((new->data = ospf_lsa_data_new(length)) == NULL) { - zlog_warn("%s: ospf_lsa_data_new() ?", __func__); - ospf_lsa_unlock(&new); - new = NULL; - stream_free(s); - return new; - } + new = ospf_lsa_new_and_data(length); new->vrf_id = ospf->vrf_id; if (area && area->ospf) -- cgit v1.2.3