new->extra->parent = bgp_info_lock(parent);
bgp_lock_node((struct bgp_node *)((struct bgp_info *)parent)->net);
if (bgp_orig)
- new->extra->bgp_orig = bgp_orig;
+ new->extra->bgp_orig = bgp_lock(bgp_orig);
if (nexthop_orig)
new->extra->nexthop_orig = *nexthop_orig;
static void bgp_info_free(struct bgp_info *binfo)
{
/* unlink reference to parent, if any. */
- if (binfo->extra && binfo->extra->parent) {
- bgp_unlock_node((struct bgp_node *)((struct bgp_info *)binfo
- ->extra->parent)->net);
- bgp_info_unlock((struct bgp_info *)binfo->extra->parent);
- binfo->extra->parent = NULL;
+ if (binfo->extra) {
+ if (binfo->extra->parent) {
+ bgp_unlock_node(
+ (struct bgp_node *)((struct bgp_info *)binfo
+ ->extra->parent)
+ ->net);
+ bgp_info_unlock(
+ (struct bgp_info *)binfo->extra->parent);
+ binfo->extra->parent = NULL;
+ }
+
+ if (binfo->extra->bgp_orig)
+ bgp_unlock(binfo->extra->bgp_orig);
}
if (binfo->attr)