diff options
author | Donald Sharp <sharpd@nvidia.com> | 2023-07-05 15:28:50 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2023-07-12 23:56:29 +0200 |
commit | 0cbd5855a97197f62b04a5b90ac79d78725511cb (patch) | |
tree | 545b3f60c52bf3ca8fa45b8b305736d1b30278ce /ospf6d/ospf6_lsa.c | |
parent | Merge pull request #13977 from anlancs/fix/mgmt-bool-change (diff) | |
download | frr-0cbd5855a97197f62b04a5b90ac79d78725511cb.tar.xz frr-0cbd5855a97197f62b04a5b90ac79d78725511cb.zip |
ospf6d: Convert ospf6_lsa_unlock to a better api
Make the ospf6_lsa_unlock take the same parameters
that the ospf_lsa_unlock does to make it consistent
and to also ensure that no-one can make the mistake
of getting the pointer cleared up.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'ospf6d/ospf6_lsa.c')
-rw-r--r-- | ospf6d/ospf6_lsa.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 2b806afe0..e745c6c57 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -797,17 +797,17 @@ struct ospf6_lsa *ospf6_lsa_lock(struct ospf6_lsa *lsa) } /* decrement reference counter of struct ospf6_lsa */ -struct ospf6_lsa *ospf6_lsa_unlock(struct ospf6_lsa *lsa) +void ospf6_lsa_unlock(struct ospf6_lsa **lsa) { /* decrement reference counter */ - assert(lsa->lock > 0); - lsa->lock--; + assert((*lsa)->lock > 0); + (*lsa)->lock--; - if (lsa->lock != 0) - return lsa; + if ((*lsa)->lock != 0) + return; - ospf6_lsa_delete(lsa); - return NULL; + ospf6_lsa_delete(*lsa); + *lsa = NULL; } |