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
This commit is contained in:
Jacob Erlbeck 2015-01-26 13:41:11 +01:00 committed by Holger Hans Peter Freyther
parent e71ab2f46f
commit 480e820206
1 changed files with 1 additions and 3 deletions

View File

@ -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);
}