aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2020-12-04 17:38:46 +0100
committerDaniel Willmann <dwillmann@sysmocom.de>2020-12-04 17:49:19 +0100
commite794c1f00b3907fcad7e0ddefce1cfad79e1eb67 (patch)
tree9bdd30b4b6e4858d632ac65598e9777c1d12319f /src
parentbd356a6d848685913b6e2bba30aea8446a0cc2cc (diff)
gbproxy: Allow gbproxy_nse_free(NULL)
Calling free() with a null-pointer is usually supported and does nothing. Change gbproxy_{peer,nse}_free() to reflect that behaviour. Change-Id: Ia32084f81ca8f8cb9ddea3adabd4b44fd766f1c7
Diffstat (limited to 'src')
-rw-r--r--src/gbproxy/gb_proxy_peer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gbproxy/gb_proxy_peer.c b/src/gbproxy/gb_proxy_peer.c
index 2b28dd56..ea5fe1ee 100644
--- a/src/gbproxy/gb_proxy_peer.c
+++ b/src/gbproxy/gb_proxy_peer.c
@@ -242,7 +242,8 @@ struct gbproxy_peer *gbproxy_peer_alloc(struct gbproxy_nse *nse, uint16_t bvci)
void gbproxy_peer_free(struct gbproxy_peer *peer)
{
- OSMO_ASSERT(peer);
+ if (!peer)
+ return;
llist_del(&peer->list);
osmo_timer_del(&peer->clean_stale_timer);
@@ -305,7 +306,8 @@ struct gbproxy_nse *gbproxy_nse_alloc(struct gbproxy_config *cfg, uint16_t nsei)
void gbproxy_nse_free(struct gbproxy_nse *nse)
{
struct gbproxy_peer *peer, *tmp;
- OSMO_ASSERT(nse);
+ if (!nse)
+ return;
llist_del(&nse->list);