[layer1] Fixed memory leak issue after releasing dedicated mode

While releasing dedicated mode, pending SDCCH and SACCH messages need to be
flushed. Without it, it would also cause old pending messages to be sent
during next dedicated mode.
This commit is contained in:
Andreas.Eversberg 2010-09-14 19:13:36 +00:00
parent cd41b6c541
commit 04ffc9bdc0
3 changed files with 17 additions and 0 deletions

View File

@ -25,6 +25,9 @@ static inline void l1a_unlock_sync(void)
/* safely enable a message into the L1S TX queue */
void l1a_txq_msgb_enq(struct llist_head *queue, struct msgb *msg);
/* flush all pending msgb */
void l1a_txq_msgb_flush(struct llist_head *queue);
/* request a RACH request at the next multiframe T3 = fn51 */
void l1a_rach_req(uint8_t fn51, uint8_t mf_off, uint8_t ra);

View File

@ -46,6 +46,18 @@ void l1a_txq_msgb_enq(struct llist_head *queue, struct msgb *msg)
local_irq_restore(flags);
}
/* flush all pending msgb */
void l1a_txq_msgb_flush(struct llist_head *queue)
{
struct msgb *msg;
unsigned long flags;
local_firq_save(flags);
while ((msg = msgb_dequeue(queue)))
msgb_free(msg);
local_irq_restore(flags);
}
/* Enable a repeating multiframe task */
void l1a_mftask_enable(enum mframe_task task)
{

View File

@ -253,6 +253,8 @@ static void l1ctl_rx_dm_rel_req(struct msgb *msg)
printd("L1CTL_DM_REL_REQ\n");
l1a_mftask_set(0);
l1s.dedicated.type = GSM_DCHAN_NONE;
l1a_txq_msgb_flush(&l1s.tx_queue[L1S_CHAN_MAIN]);
l1a_txq_msgb_flush(&l1s.tx_queue[L1S_CHAN_SACCH]);
}
/* receive a L1CTL_RACH_REQ from L23 */