From 4d9fc422d2dd17118d70a2ed25ab383614a81ede Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 4 Aug 2014 12:18:07 +0200 Subject: gbproxy: Use gbprox_delete_tlli if possible Make use of the delete routine in more places and get test coverage for it. Done with Jacob --- openbsc/src/gprs/gb_proxy.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'openbsc') diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c index 4fa77acac..20d1180c4 100644 --- a/openbsc/src/gprs/gb_proxy.c +++ b/openbsc/src/gprs/gb_proxy.c @@ -433,12 +433,10 @@ static void gbprox_delete_tllis(struct gbproxy_peer *peer) struct gbproxy_tlli_info *tlli_info, *nxt; struct gbproxy_patch_state *state = &peer->patch_state; - llist_for_each_entry_safe(tlli_info, nxt, &state->enabled_tllis, list) { - llist_del(&tlli_info->list); - talloc_free(tlli_info); - } - state->enabled_tllis_count = 0; + llist_for_each_entry_safe(tlli_info, nxt, &state->enabled_tllis, list) + gbprox_delete_tlli(peer, tlli_info); + OSMO_ASSERT(state->enabled_tllis_count == 0); OSMO_ASSERT(llist_empty(&state->enabled_tllis)); } @@ -634,9 +632,7 @@ static void gbprox_unregister_tlli(struct gbproxy_peer *peer, uint32_t tlli) LOGP(DGPRS, LOGL_INFO, "Removing TLLI %08x from list\n", tlli); - llist_del(&tlli_info->list); - talloc_free(tlli_info); - state->enabled_tllis_count -= 1; + gbprox_delete_tlli(peer, tlli_info); } peer->ctrg->ctr[GBPROX_PEER_CTR_TLLI_CACHE_SIZE].current = -- cgit v1.2.3