[MERGED] osmocom-bb[master]: mobile: Fix memory leak when not using a LUA script

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Feb 23 08:43:21 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: mobile: Fix memory leak when not using a LUA script
......................................................................


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

Approvals:
  Vadim Yanitskiy: Looks good to me, but someone else must approve; Verified
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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 @@
 		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: merged
Gerrit-Change-Id: I510af13bcbb46f73a0a289f26a4921cc90bd986a
Gerrit-PatchSet: 3
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: fixeria <axilirator at gmail.com>



More information about the gerrit-log mailing list