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.
This commit is contained in:
Holger Hans Peter Freyther 2010-11-14 16:04:46 +01:00
parent 8d216c7756
commit abf962b096
2 changed files with 2 additions and 11 deletions

View File

@ -368,10 +368,8 @@ int gsm0808_clear(struct gsm_subscriber_connection *conn)
if (conn->ho_lchan)
bsc_clear_handover(conn);
if (conn->lchan) {
if (conn->lchan)
lchan_release(conn->lchan, 1, 0);
conn->lchan->conn = NULL;
}
conn->lchan = NULL;
conn->ho_lchan = NULL;

View File

@ -281,13 +281,6 @@ struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type,
/* 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 @@ void lchan_free(struct gsm_lchan *lchan)
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 @@ int lchan_release(struct gsm_lchan *lchan, int sach_deact, int reason)
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);