From c0a6674614fb362c80d2a83bd3e543ccd4bf0c49 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 29 Dec 2011 23:33:04 +0100 Subject: channel: Review lchan_free calls and the state the channel is in In case of a memory allocation failure in rsl_rx_chan_rqd we would have left the channel in the LCHAN_S_ACT_REQ state. Move the state change below the allocation. --- openbsc/src/libbsc/abis_rsl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbsc/src/libbsc') diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 63b8729b7..c508e39e2 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -1284,7 +1284,6 @@ static int rsl_rx_chan_rqd(struct msgb *msg) LOGP(DRSL, LOGL_NOTICE, "%s lchan_alloc() returned channel " "in state %s\n", gsm_lchan_name(lchan), gsm_lchans_name(lchan->state)); - rsl_lchan_set_state(lchan, LCHAN_S_ACT_REQ); /* save the RACH data as we need it after the CHAN ACT ACK */ lchan->rqd_ref = talloc_zero(bts, struct gsm48_req_ref); @@ -1294,6 +1293,7 @@ static int rsl_rx_chan_rqd(struct msgb *msg) return -ENOMEM; } + rsl_lchan_set_state(lchan, LCHAN_S_ACT_REQ); memcpy(lchan->rqd_ref, rqd_ref, sizeof(*rqd_ref)); lchan->rqd_ta = rqd_ta; -- cgit v1.2.3