[PATCH] libosmo-sccp[master]: xua: fix possible memory leak in seems osmo_ss7_asp_use_defa...

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

dexter gerrit-no-reply at lists.osmocom.org
Fri Jul 21 11:54:01 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/3325

to look at the new patch set (#2).

xua: fix possible memory leak in seems osmo_ss7_asp_use_default_lm()

The function seems osmo_ss7_asp_use_default_lm() does not guard
against an asp->lm_priv FSM instance already existing. If this
function is called a second time, it will overwrite asp->lm_priv,
causing the original fsm instance to leaked.

Check if asp->lm_priv already exists and terminate (free) the
FSM if present.

Change-Id: I4ad435c042a435c4e641c6e5c53b91265dd23d40
---
M src/xua_default_lm_fsm.c
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/25/3325/2

diff --git a/src/xua_default_lm_fsm.c b/src/xua_default_lm_fsm.c
index 9308de4..2a03cbc 100644
--- a/src/xua_default_lm_fsm.c
+++ b/src/xua_default_lm_fsm.c
@@ -366,6 +366,11 @@
 	struct lm_fsm_priv *lmp;
 	struct osmo_fsm_inst *fi;
 
+	if (asp->lm_priv) {
+		osmo_fsm_inst_term(asp->lm_priv, OSMO_FSM_TERM_ERROR, NULL);
+		asp->lm_priv = NULL;
+	}
+
 	fi = osmo_fsm_inst_alloc(&xua_default_lm_fsm, asp, NULL, log_level, asp->cfg.name);
 
 	lmp = talloc_zero(fi, struct lm_fsm_priv);

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I4ad435c042a435c4e641c6e5c53b91265dd23d40
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list