aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-01-26 13:41:11 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-01-27 08:31:36 +0100
commit306bb993aab07f115ff6cbc89d81f862e08f7c32 (patch)
treef6806a6b89bed4677e91412cbb2f53e8dede14b3
parent3e4e58f349c201a2ed02971ef95051773fcef39b (diff)
sgsn: Don't reset mm->subscr manually in sgsn_mm_ctx_free
Currently the sgsn_mm_ctx_free contains code to reset the mm->subscr field that is also present in gprs_subscr_cleanup, which is called directly afterwards. This commit modifies the code path, so that the cleanup is done by the gprs_subscr_cleanup function. The additional reference counter increment is needed, since mm->subscr->mm->subscr (which is the same like mm->subscr) will be reset (and unref'd) within gprs_subscr_cleanup. Because the local variable subscr in sgsn_mm_ctx_free is an additional pointer to the subscriber object, it is consequent to adjust the reference counter when the assignment is done. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/src/gprs/gprs_sgsn.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c
index 490371f6a..781be3ffb 100644
--- a/openbsc/src/gprs/gprs_sgsn.c
+++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -196,9 +196,7 @@ void sgsn_mm_ctx_free(struct sgsn_mm_ctx *mm)
/* Detach from subscriber which is possibly freed then */
if (mm->subscr) {
- struct gsm_subscriber *subscr = mm->subscr;
- mm->subscr = NULL;
- subscr->sgsn_data->mm = NULL;
+ struct gsm_subscriber *subscr = subscr_get(mm->subscr);
gprs_subscr_cleanup(subscr);
subscr_put(subscr);
}