[subcriber] Fix the subscriber use counting in gsm_04_08.c (Andreas Eversberg)
This patch will fix subscriber usage countinig.
It may happen, that the subscriber count will not be 0 after releasing
of a call. (This problem is solved with the application patch (27),
which will replace static call transaction by a dynamic transaction
list, and use subscriber for each transaction created.)
diff --git a/src/gsm_04_08.c b/src/gsm_04_08.c
index 07e7a46..368b2f4 100644
--- a/src/gsm_04_08.c
+++ b/src/gsm_04_08.c
@@ -851,6 +851,7 @@
GSM_SUBSCRIBER_UPDATE_DETACHED);
DEBUGP(DMM, "Subscriber: %s\n",
subscr->name ? subscr->name : subscr->imsi);
+ subscr_put(subscr);
} else
DEBUGP(DMM, "Unknown Subscriber ?!?\n");
@@ -935,11 +936,16 @@
DEBUGP(DRR, "<- Channel was requested by %s\n",
subscr->name ? subscr->name : subscr->imsi);
- if (!msg->lchan->subscr)
+ if (!msg->lchan->subscr) {
msg->lchan->subscr = subscr;
- else if (msg->lchan->subscr != subscr) {
+ } else if (msg->lchan->subscr != subscr) {
DEBUGP(DRR, "<- Channel already owned by someone else?\n");
subscr_put(subscr);
+ return -EINVAL;
+ } else {
+ DEBUGP(DRR, "<- Channel already owned by us\n");
+ subscr_put(subscr);
+ subscr = msg->lchan->subscr;
}
sig_data.subscr = subscr;