avdtp: fix wrongly freed stream endpoint

This commit is contained in:
Milanka Ringwald 2017-06-13 15:22:58 +02:00
parent a635c9d9b2
commit ac98fce4e3
2 changed files with 7 additions and 3 deletions

View File

@ -552,11 +552,15 @@ void avdtp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet
if (connection){
log_info(" -> AVDTP_STREAM_ENDPOINT_IDLE, connection closed");
btstack_linked_list_remove(avdtp_connections, (btstack_linked_item_t*) connection);
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, stream_endpoints);
while (btstack_linked_list_iterator_has_next(&it)){
avdtp_stream_endpoint_t * _stream_endpoint = (avdtp_stream_endpoint_t *)btstack_linked_list_iterator_next(&it);
btstack_memory_avdtp_stream_endpoint_free(_stream_endpoint);
if (_stream_endpoint->connection == connection){
avdtp_initialize_stream_endpoint(_stream_endpoint);
}
}
btstack_memory_avdtp_connection_free(connection);
break;

View File

@ -590,7 +590,7 @@ static void avrcp_handle_l2cap_data_packet_for_signaling_connection(avrcp_connec
uint8_t pdu_id = operands[3];
if (connection->state != AVCTP_W2_RECEIVE_RESPONSE && pdu_id != AVRCP_PDU_ID_REGISTER_NOTIFICATION){
printf("AVRCP_CMD_OPCODE_VENDOR_DEPENDENT state %d \n", connection->state);
log_info("AVRCP_CMD_OPCODE_VENDOR_DEPENDENT state %d", connection->state);
return;
}
connection->state = AVCTP_CONNECTION_OPENED;
@ -962,7 +962,7 @@ static void avrcp_handle_l2cap_data_packet_for_signaling_connection(avrcp_connec
break;
default:
// check for notifications? move state transition down
printf("AVRCP_CMD_OPCODE_PASS_THROUGH state %d\n", connection->state);
// log_info("AVRCP_CMD_OPCODE_PASS_THROUGH state %d\n", connection->state);
break;
}
if (connection->state == AVCTP_W4_STOP){