abis_rsl: Send the IMMEDIATE Assignment after the Channel Ack.

The Channel Activate might be sent to a different TRX than the
Immediate Assignment. So we need to make sure that the channel
is activated before we send the immediate assignment for the RACH.

Another reason for that is according to GSM 08.58 we should take
the frame number from the activate and use it for the starting
time inside the immediate assignment message. We obviously do not
do this yet.

The code assumes that the BTS will either respond with a CHAN ACK
or a CHAN NACK if not the lchan will remain in the request state.
diff --git a/openbsc/src/chan_alloc.c b/openbsc/src/chan_alloc.c
index d6e4ff1..c59c0a1 100644
--- a/openbsc/src/chan_alloc.c
+++ b/openbsc/src/chan_alloc.c
@@ -33,6 +33,8 @@
 #include <openbsc/debug.h>
 #include <openbsc/signal.h>
 
+#include <osmocore/talloc.h>
+
 static void auto_release_channel(void *_lchan);
 
 static int ts_is_usable(struct gsm_bts_trx_ts *ts)
@@ -320,6 +322,12 @@
 	for (i = 0; i < ARRAY_SIZE(lchan->neigh_meas); i++)
 		lchan->neigh_meas[i].arfcn = 0;
 
+	if (lchan->rqd_ref) {
+		talloc_free(lchan->rqd_ref);
+		lchan->rqd_ref = NULL;
+		lchan->rqd_ta = 0;
+	}
+
 	lchan->conn.silent_call = 0;
 
 	sig.lchan = lchan;