From 8b9d3170ff265c934f6271bd445ff5a6788ffffb Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 23 Feb 2018 07:31:25 +0000 Subject: mobile: Fix memory leak when not using a LUA script The primitives are still allocated and dispatched but there was no script handler to delete them. Change the ownership to delete it at the end of the dispatch. Change-Id: I510af13bcbb46f73a0a289f26a4921cc90bd986a Fixes: OS#2925 --- src/host/layer23/src/mobile/primitives.c | 1 + src/host/layer23/src/mobile/script_lua.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/host/layer23/src/mobile/primitives.c b/src/host/layer23/src/mobile/primitives.c index 96f0f9c2..aa467128 100644 --- a/src/host/layer23/src/mobile/primitives.c +++ b/src/host/layer23/src/mobile/primitives.c @@ -110,6 +110,7 @@ static void dispatch(struct osmocom_ms *ms, struct mobile_prim *prim) if (intf->ms == ms) intf->indication(intf, prim); } + msgb_free(prim->hdr.msg); } void mobile_prim_ntfy_started(struct osmocom_ms *ms, bool started) diff --git a/src/host/layer23/src/mobile/script_lua.c b/src/host/layer23/src/mobile/script_lua.c index 9b256d3a..8d3064d0 100644 --- a/src/host/layer23/src/mobile/script_lua.c +++ b/src/host/layer23/src/mobile/script_lua.c @@ -451,8 +451,6 @@ static void lua_prim_ind(struct mobile_prim_intf *intf, struct mobile_prim *prim default: LOGP(DLUA, LOGL_ERROR, "Unknown primitive: %d\n", OSMO_PRIM_HDR(&prim->hdr)); }; - - msgb_free(prim->hdr.msg); } /* -- cgit v1.2.3