]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: Fix memory allocation issues in SPF
authorTom Goff <thomas.goff@boeing.com>
Wed, 10 Nov 2010 21:02:38 +0000 (13:02 -0800)
committerDenis Ovsienko <infrastation@yandex.ru>
Sun, 25 Sep 2011 14:15:27 +0000 (18:15 +0400)
* 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_area.c
ospf6d/ospf6_spf.c

index 0224fe68c5c0a29c5c16adbc12edd06396d9bdf3..9934e6b9c79d598802aa0c9dedf1fda01abc1ee6 100644 (file)
@@ -199,6 +199,7 @@ ospf6_area_delete (struct ospf6_area *oa)
   ospf6_lsdb_delete (oa->lsdb);
   ospf6_lsdb_delete (oa->lsdb_self);
 
+  ospf6_spf_table_finish (oa->spf_table);
   ospf6_route_table_delete (oa->spf_table);
   ospf6_route_table_delete (oa->route_table);
 
index e78f7f6a59beef0bf61a794957ef6f8cb4f3b560..a4a5b7218428d9903d169c0fe0fbebf3cf7e4c5f 100644 (file)
@@ -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;