From 1f69b4653b2ff73a2b9a0dcaab0bf4cef6d11d35 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 16 Sep 2010 22:49:37 +0800 Subject: 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. --- openbsc/src/bsc_api.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'openbsc') diff --git a/openbsc/src/bsc_api.c b/openbsc/src/bsc_api.c index 576440f9d..ba6dd8852 100644 --- a/openbsc/src/bsc_api.c +++ b/openbsc/src/bsc_api.c @@ -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; } -- cgit v1.2.3