From 5e46e4b4880f01eed508d49b66d96c1f7475ab89 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 22 Jan 2013 15:36:49 +0100 Subject: sysmobts: Fix a memory leak when no callback is set The TxPower handled used to call the requestion function without a callback. In that case the msgb is leaked. The code still allows the callback to be NULL so we will just delete the message in that case. --- src/osmo-bts-sysmo/l1_if.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/osmo-bts-sysmo/l1_if.c') diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index 7040a5fe..d848f7de 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -882,8 +882,10 @@ int l1if_handle_l1prim(int wq, struct femtol1_hdl *fl1h, struct msgb *msg) llist_del(&wlc->list); if (wlc->cb) rc = wlc->cb(fl1h->priv, msg); - else + else { rc = 0; + msgb_free(msg); + } release_wlc(wlc); return rc; } @@ -910,8 +912,10 @@ int l1if_handle_sysprim(struct femtol1_hdl *fl1h, struct msgb *msg) llist_del(&wlc->list); if (wlc->cb) rc = wlc->cb(fl1h->priv, msg); - else + else { rc = 0; + msgb_free(msg); + } release_wlc(wlc); return rc; } -- cgit v1.2.3