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
This commit is contained in:
Daniel Willmann 2020-12-04 17:38:46 +01:00
parent bd356a6d84
commit e794c1f00b
1 changed files with 4 additions and 2 deletions

View File

@ -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);