Review at  https://gerrit.osmocom.org/6845

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
---
M src/host/layer23/src/mobile/primitives.c
M src/host/layer23/src/mobile/script_lua.c
2 files changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/45/6845/1

diff --git a/src/host/layer23/src/mobile/primitives.c 
b/src/host/layer23/src/mobile/primitives.c
index c3f28a5..2d3e4ad 100644
--- a/src/host/layer23/src/mobile/primitives.c
+++ b/src/host/layer23/src/mobile/primitives.c
@@ -107,6 +107,7 @@
                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 @@
        default:
                LOGP(DLUA, LOGL_ERROR, "Unknown primitive: %d\n", 
OSMO_PRIM_HDR(&prim->hdr));
        };
-
-       msgb_free(prim->hdr.msg);
 }
 
 /*

-- 
To view, visit https://gerrit.osmocom.org/6845
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I510af13bcbb46f73a0a289f26a4921cc90bd986a
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther <hol...@freyther.de>

Reply via email to