bsc: Fix the clear to release resources first, then set to NULL

This is fixing a crash reported by Nico. Somehow I staged an
unfinished version of this code. The crash should be gone.
This commit is contained in:
Holger Hans Peter Freyther 2010-09-16 22:49:37 +08:00
parent f11af07431
commit 1f69b4653b
1 changed files with 7 additions and 9 deletions

View File

@ -189,20 +189,18 @@ int gsm0808_cipher_mode(struct gsm_subscriber_connection *conn, int cipher,
*/
int gsm0808_clear(struct gsm_subscriber_connection* conn)
{
struct gsm_lchan *lchan;
if (conn->ho_lchan)
bsc_clear_handover(conn);
if (conn->lchan) {
lchan_release(conn->lchan, 1, 0);
conn->lchan->conn = NULL;
}
lchan = conn->lchan;
conn->lchan = NULL;
conn->ho_lchan = NULL;
conn->bts = NULL;
if (conn->ho_lchan)
bsc_clear_handover(conn);
if (conn->lchan)
lchan_release(lchan, 1, 0);
conn->lchan->conn = NULL;
conn->lchan = NULL;
return 0;
}