From 680b8ceb9ecf2e68b589ed296589b3ba2953af21 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 19 Nov 2020 08:04:51 -0500 Subject: [PATCH] ospf6d: More lists being leaked Apparently the person who wrote this code was big into cut-n-paste. Commit 710a61d57c8f1b0ea66a37f09bad2161d7e2ddb7 found the first instance, but upon code inspection this morning it became evident that 2 other functions had the exact same problem. Fix. Note I have not cleaned up the cut-n-paste code for two reasons: a) I'm chasing something else b) this code has been fairly un-maintained for a very long time. No need to start up now. Signed-off-by: Donald Sharp --- ospf6d/ospf6_snmp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c index 1836dc2068..51a3bff2a3 100644 --- a/ospf6d/ospf6_snmp.c +++ b/ospf6d/ospf6_snmp.c @@ -963,8 +963,6 @@ static uint8_t *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, else if (v->magic & OSPFv3WWLINKTABLE) { /* We build a sorted list of interfaces */ ifslist = list_new(); - if (!ifslist) - return NULL; ifslist->cmp = (int (*)(void *, void *))if_icmp_func; FOR_ALL_INTERFACES (vrf, iif) listnode_add_sort(ifslist, iif); @@ -993,6 +991,7 @@ static uint8_t *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, } list_delete_all_node(ifslist); + list_delete(&ifslist); } } @@ -1100,8 +1099,6 @@ static uint8_t *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, } else { /* We build a sorted list of interfaces */ ifslist = list_new(); - if (!ifslist) - return NULL; ifslist->cmp = (int (*)(void *, void *))if_icmp_func; FOR_ALL_INTERFACES (vrf, iif) listnode_add_sort(ifslist, iif); @@ -1121,6 +1118,7 @@ static uint8_t *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, } list_delete_all_node(ifslist); + list_delete(&ifslist); } if (!oi) -- 2.39.5