Merge pull request #12367 from rgirada/ospf_valgrind_fix

ospfd: Fixing a memleak.
This commit is contained in:
Russ White 2022-11-29 11:23:27 -05:00 committed by GitHub
commit c0a4793035
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,6 +89,25 @@ static int ospf_network_match_iface(const struct connected *,
const struct prefix *);
static void ospf_finish_final(struct ospf *);
/* API to clean refresh queues and LSAs */
static void ospf_free_refresh_queue(struct ospf *ospf)
{
for (int i = 0; i < OSPF_LSA_REFRESHER_SLOTS; i++) {
struct list *list = ospf->lsa_refresh_queue.qs[i];
struct listnode *node, *nnode;
struct ospf_lsa *lsa;
if (list) {
for (ALL_LIST_ELEMENTS(list, node, nnode, lsa)) {
listnode_delete(list, lsa);
lsa->refresh_list = -1;
ospf_lsa_unlock(&lsa);
}
list_delete(&list);
ospf->lsa_refresh_queue.qs[i] = NULL;
}
}
}
#define OSPF_EXTERNAL_LSA_ORIGINATE_DELAY 1
int p_spaces_compare_func(const struct p_space *a, const struct p_space *b)
@ -895,6 +914,8 @@ static void ospf_finish_final(struct ospf *ospf)
route_table_finish(ospf->rt_aggr_tbl);
ospf_free_refresh_queue(ospf);
list_delete(&ospf->areas);
list_delete(&ospf->oi_write_q);