summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2018-02-23 07:31:25 +0000
committerHarald Welte <laforge@gnumonks.org>2018-02-23 08:43:21 +0000
commit8b9d3170ff265c934f6271bd445ff5a6788ffffb (patch)
tree5e5d0a9a3c24189f92f9f4f8b74f7562e3333f87
parentaf4bad3125724b585763f94718f3f5c5d3b94f23 (diff)
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
-rw-r--r--src/host/layer23/src/mobile/primitives.c1
-rw-r--r--src/host/layer23/src/mobile/script_lua.c2
2 files changed, 1 insertions, 2 deletions
diff --git a/src/host/layer23/src/mobile/primitives.c b/src/host/layer23/src/mobile/primitives.c
index 96f0f9c..aa46712 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 9b256d3..8d3064d 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);
}
/*