fix unbelievable hard code for deleting items in linked list while iterating over it

This commit is contained in:
matthias.ringwald 2010-07-17 18:39:51 +00:00
parent 39ce35a7ca
commit 78a6f10031

View File

@ -306,7 +306,7 @@ void l2cap_event_handler( uint8_t *packet, uint16_t size ){
handle = READ_BT_16(packet, 3);
linked_item_t *it;
// only access next element to allows for removal
for (it = (linked_item_t *) &l2cap_channels; it ; it = it->next){
for (it = (linked_item_t *) &l2cap_channels; it->next ; it = it->next){
l2cap_channel_t * channel = (l2cap_channel_t *) it->next;
if ( channel->handle == handle ){
// update prev item before free'ing next element