if (req == on->last_ls_req) {
/* sanity check refcount */
assert(req->lock >= 2);
- ospf6_lsa_unlock(req);
+ req = ospf6_lsa_unlock(req);
on->last_ls_req = NULL;
}
- ospf6_lsdb_remove(req,
- on->request_list);
+ if (req)
+ ospf6_lsdb_remove(
+ req, on->request_list);
ospf6_check_nbr_loading(on);
continue;
}
zlog_debug(
"Received is newer, remove requesting");
if (req == on->last_ls_req) {
- ospf6_lsa_unlock(req);
+ req = ospf6_lsa_unlock(req);
on->last_ls_req = NULL;
}
if (req)
}
/* decrement reference counter of struct ospf6_lsa */
-void ospf6_lsa_unlock(struct ospf6_lsa *lsa)
+struct ospf6_lsa *ospf6_lsa_unlock(struct ospf6_lsa *lsa)
{
/* decrement reference counter */
assert(lsa->lock > 0);
lsa->lock--;
if (lsa->lock != 0)
- return;
+ return lsa;
ospf6_lsa_delete(lsa);
+ return NULL;
}
extern struct ospf6_lsa *ospf6_lsa_copy(struct ospf6_lsa *);
extern void ospf6_lsa_lock(struct ospf6_lsa *);
-extern void ospf6_lsa_unlock(struct ospf6_lsa *);
+extern struct ospf6_lsa *ospf6_lsa_unlock(struct ospf6_lsa *);
extern int ospf6_lsa_expire(struct thread *);
extern int ospf6_lsa_refresh(struct thread *);
}
/* to free the lookup lock in node get*/
route_unlock_node(current);
- ospf6_lsa_unlock(old);
+ old = ospf6_lsa_unlock(old);
}
ospf6_lsdb_count_assert(lsdb);
route_unlock_node(node); /* to free the lookup lock */
route_unlock_node(node); /* to free the original lock */
- ospf6_lsa_unlock(lsa);
+ lsa = ospf6_lsa_unlock(lsa);
ospf6_lsdb_count_assert(lsdb);
}
{
struct route_node *node = lsa->rn;
- ospf6_lsa_unlock(lsa);
+ lsa = ospf6_lsa_unlock(lsa);
do
node = route_next_until(node, iterend);
if (lsa != NULL) {
if (lsa->rn != NULL)
route_unlock_node(lsa->rn);
- ospf6_lsa_unlock(lsa);
+ lsa = ospf6_lsa_unlock(lsa);
}
}
}
if (last_req != NULL) {
- if (on->last_ls_req != NULL) {
- ospf6_lsa_unlock(on->last_ls_req);
- }
+ if (on->last_ls_req != NULL)
+ on->last_ls_req = ospf6_lsa_unlock(on->last_ls_req);
+
ospf6_lsa_lock(last_req);
on->last_ls_req = last_req;
}