aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-12-21 17:34:37 +0100
committerOliver Smith <osmith@sysmocom.de>2021-12-21 18:58:20 +0100
commit853ce2ec134101268eda1a5b0f044fb29b3b7369 (patch)
tree5dcf40ff9252d5e1c1e574a8ac6e70753fc30e86
parent0aa3164b93c47e002686162c12cb6ef48dcf35b5 (diff)
osmo_ss7_instance_destroy: use for_each_entry_safe
Fix segfault in each loop. Change-Id: Ieaec3584375b0e6b943638fe1e50b4d74a627216
-rw-r--r--src/osmo_ss7.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 649e3f7..99536d3 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -410,20 +410,20 @@ osmo_ss7_instance_find_or_create(void *ctx, uint32_t id)
* \param[in] inst SS7 Instance to be destroyed */
void osmo_ss7_instance_destroy(struct osmo_ss7_instance *inst)
{
- struct osmo_ss7_linkset *lset;
- struct osmo_ss7_as *as;
- struct osmo_ss7_asp *asp;
+ struct osmo_ss7_linkset *lset, *lset2;
+ struct osmo_ss7_as *as, *as2;
+ struct osmo_ss7_asp *asp, *asp2;
OSMO_ASSERT(ss7_initialized);
LOGSS7(inst, LOGL_INFO, "Destroying SS7 Instance\n");
- llist_for_each_entry(asp, &inst->asp_list, list)
+ llist_for_each_entry_safe(asp, asp2, &inst->asp_list, list)
osmo_ss7_asp_destroy(asp);
- llist_for_each_entry(as, &inst->as_list, list)
+ llist_for_each_entry_safe(as, as2, &inst->as_list, list)
osmo_ss7_as_destroy(as);
- llist_for_each_entry(lset, &inst->linksets, list)
+ llist_for_each_entry_safe(lset, lset2, &inst->linksets, list)
osmo_ss7_linkset_destroy(lset);
llist_del(&inst->list);