summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_spf.c
diff options
context:
space:
mode:
authorpaul <paul>2005-06-13 13:57:16 +0000
committerpaul <paul>2005-06-13 13:57:16 +0000
commitd1fda7f00af05950c9d0ff3d6b6b8cc61cd585d6 (patch)
tree9d2e536dfe755d0573db44140cf1056fae580798 /ospfd/ospf_spf.c
parent01eb8932f17e82dfb8c02894796591fb62838fb2 (diff)
downloadquagga-d1fda7f00af05950c9d0ff3d6b6b8cc61cd585d6.tar.bz2
quagga-d1fda7f00af05950c9d0ff3d6b6b8cc61cd585d6.tar.xz
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.
Diffstat (limited to 'ospfd/ospf_spf.c')
-rw-r--r--ospfd/ospf_spf.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c
index e34dd2ee..206a2e7c 100644
--- a/ospfd/ospf_spf.c
+++ b/ospfd/ospf_spf.c
@@ -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. */