]> git.puffer.fish Git - mirror/frr.git/commitdiff
2005-06-13 Paul Jakma <paul.jakma@sun.com>
authorpaul <paul>
Mon, 13 Jun 2005 13:57:16 +0000 (13:57 +0000)
committerpaul <paul>
Mon, 13 Jun 2005 13:57:16 +0000 (13:57 +0000)
* ospf_spf.c: Try get more information on a SEGV under
  ospf_spf_vertex_add_parent.
  (ospf_vertex_free) NULL out the child and nexthop lists
  (ospf_vertex_add_parent) nexthop and child can not be NULL
  vertex_nexthop's parent->child list can not be NULL
  (ospf_spf_next) w and cw are per-loop iteration variables, move
  declarations into loop body.

ospfd/ChangeLog
ospfd/ospf_spf.c

index b45739d985dde6abd501b3977b8276883a8771d0..4ba7adddccdc3a9cd54ca64e953c5ad708eecb41 100644 (file)
@@ -1,3 +1,13 @@
+2005-06-13 Paul Jakma <paul.jakma@sun.com>
+
+       * ospf_spf.c: Try get more information on a SEGV under 
+         ospf_spf_vertex_add_parent.
+         (ospf_vertex_free) NULL out the child and nexthop lists
+         (ospf_vertex_add_parent) nexthop and child can not be NULL
+         vertex_nexthop's parent->child list can not be NULL
+         (ospf_spf_next) w and cw are per-loop iteration variables, move
+         declarations into loop body.
+         
 2005-06-07 Hasso Tepper <hasso at quagga.net>
 
        * ospf_apiserver.c: Fix obvious error in notifying clients about ISM
index e34dd2ee80a0e75735c35a7a60519981116559cf..206a2e7c3cf2097bd5ff1408b205a3d05f042a34 100644 (file)
@@ -129,13 +129,15 @@ ospf_vertex_free (struct vertex *v)
   struct vertex_nexthop *nh;
 
   list_delete (v->child);
-
+  v->child = NULL;
+  
   if (listcount (v->nexthop) > 0)
     for (ALL_LIST_ELEMENTS (v->nexthop, node, nnode, nh))
       vertex_nexthop_free (nh);
 
   list_delete (v->nexthop);
-
+  v->nexthop = NULL;
+  
   XFREE (MTYPE_OSPF_VERTEX, v);
 }
 
@@ -194,9 +196,13 @@ ospf_vertex_add_parent (struct vertex *v)
 {
   struct vertex_nexthop *nh;
   struct listnode *node;
-
+  
+  assert (v->nexthop && v->child);
+  
   for (ALL_LIST_ELEMENTS_RO (v->nexthop, node, nh))
     {
+      assert (nh->parent && nh->parent->child);
+      
       /* No need to add two links from the same parent. */
       if (listnode_lookup (nh->parent->child, v) == NULL)
         listnode_add (nh->parent->child, v);
@@ -625,7 +631,6 @@ ospf_spf_next (struct vertex *v, struct ospf_area *area,
               struct pqueue * candidate)
 {
   struct ospf_lsa *w_lsa = NULL;
-  struct vertex *w, *cw;
   u_char *p;
   u_char *lim;
   struct router_lsa_link *l = NULL;
@@ -645,6 +650,8 @@ ospf_spf_next (struct vertex *v, struct ospf_area *area,
 
   while (p < lim)
     {
+      struct vertex *w, *cw;
+      
       int link = -1; /* link index for w's back link */
       
       /* In case of V is Router-LSA. */