From: paul Date: Mon, 13 Jun 2005 13:57:16 +0000 (+0000) Subject: 2005-06-13 Paul Jakma X-Git-Tag: frr-2.0-rc1~2979 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=7461d4594aad716f24690c68c5f82bd865cf9c25;p=matthieu%2Ffrr.git 2005-06-13 Paul Jakma * 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. --- diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog index b45739d985..4ba7adddcc 100644 --- a/ospfd/ChangeLog +++ b/ospfd/ChangeLog @@ -1,3 +1,13 @@ +2005-06-13 Paul Jakma + + * 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 * ospf_apiserver.c: Fix obvious error in notifying clients about ISM diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index e34dd2ee80..206a2e7c3c 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. */