bsc_api: Clear lchan->conn on lchan_release
Set conn to NULL before starting the release procedure, remove
code to check for a lchan->conn as it can not happen. If there
are any memleaks we will notice them.
Detach the lchan->conn from the channel before detaching.
diff --git a/openbsc/src/chan_alloc.c b/openbsc/src/chan_alloc.c
index 2cdd992..ff5600b 100644
--- a/openbsc/src/chan_alloc.c
+++ b/openbsc/src/chan_alloc.c
@@ -281,13 +281,6 @@
/* clear multi rate config */
memset(&lchan->mr_conf, 0, sizeof(lchan->mr_conf));
-
- /* clear per MSC/BSC data */
- if (lchan->conn) {
- LOGP(DRLL, LOGL_ERROR, "lchan->conn should be NULL.\n");
- subscr_con_free(lchan->conn);
- lchan->conn = NULL;
- }
} else {
struct challoc_signal_data sig;
sig.bts = bts;
@@ -338,7 +331,6 @@
if (lchan->conn) {
LOGP(DRLL, LOGL_ERROR, "the subscriber connection should be gone.\n");
- subscr_con_free(lchan->conn);
lchan->conn = NULL;
}
@@ -422,6 +414,7 @@
DEBUGP(DRLL, "%s starting release sequence\n", gsm_lchan_name(lchan));
rsl_lchan_set_state(lchan, LCHAN_S_REL_REQ);
+ lchan->conn = NULL;
lchan->release_reason = reason;
lchan->sach_deact = sach_deact;
_lchan_handle_release(lchan);