From 158dd4d00ecb0af0d1a77fdc7d4844fc88a0f10f Mon Sep 17 00:00:00 2001 From: Tom Goff Date: Wed, 10 Nov 2010 13:02:38 -0800 Subject: ospf6d: Fix memory allocation issues in SPF * ospf6_area.c: Call ospf6_spf_table_finish() before deleting the spf table. This ensures that the associated ospf6_vertex structures are also freed. * ospf6_spf.c: Only allocate a priority queue when a spf calculation is actually performed. --- ospf6d/ospf6_spf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ospf6d/ospf6_spf.c') diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index e78f7f6a..a4a5b721 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -391,10 +391,6 @@ ospf6_spf_calculation (u_int32_t router_id, caddr_t lsdesc; struct ospf6_lsa *lsa; - /* initialize */ - candidate_list = pqueue_create (); - candidate_list->cmp = ospf6_vertex_cmp; - ospf6_spf_table_finish (result_table); /* Install the calculating router itself as the root of the SPF tree */ @@ -403,6 +399,11 @@ ospf6_spf_calculation (u_int32_t router_id, router_id, oa->lsdb); if (lsa == NULL) return; + + /* initialize */ + candidate_list = pqueue_create (); + candidate_list->cmp = ospf6_vertex_cmp; + root = ospf6_vertex_create (lsa); root->area = oa; root->cost = 0; -- cgit v1.2.1