[PATCH] libosmo-sccp[master]: free local variable 'prim' in lm_timer_cb() of lm_fsm

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/.

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Tue May 8 13:59:19 UTC 2018


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

free local variable 'prim' in lm_timer_cb() of lm_fsm

The local variable 'prim', allocated via xua_xlm_prim_alloc(), was
never freed. Free it like other callers of xua_xlm_prim_alloc() do.

Found by code inspection.

Also, assert that allocation suceeded like we do elsewhere.

Change-Id: Ie667b1b8beeda2aa4520a1413f51101435215cc0
Related: OS#2449
---
M src/xua_default_lm_fsm.c
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/65/8065/1

diff --git a/src/xua_default_lm_fsm.c b/src/xua_default_lm_fsm.c
index eba89c2..5a15533 100644
--- a/src/xua_default_lm_fsm.c
+++ b/src/xua_default_lm_fsm.c
@@ -175,6 +175,7 @@
 		 * let's dynamically register */
 		osmo_fsm_inst_state_chg(fi, S_RKM_REG, 10, T_WAIT_RK_REG_RESP);
 		prim = xua_xlm_prim_alloc(OSMO_XLM_PRIM_M_RK_REG, PRIM_OP_REQUEST);
+		OSMO_ASSERT(prim);
 		as = find_first_as_in_asp(lmp->asp);
 		if (!as) {
 			LOGPFSML(fi, LOGL_ERROR, "Unable to find AS!\n");
@@ -184,6 +185,7 @@
 		/* Fill in settings from first AS (TODO: multiple AS support) */
 		prim->u.rk_reg.key = as->cfg.routing_key;
 		osmo_xlm_sap_down(lmp->asp, &prim->oph);
+		msgb_free(prim->oph.msg);
 		break;
 	case T_WAIT_NOTIFY_RKM:
 		/* No AS has reported via NOTIFY even after dynamic RKM

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie667b1b8beeda2aa4520a1413f51101435215cc0
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>



More information about the gerrit-log mailing list