bt: Fixed memory leak due to not freeing memory if posting a message to a thread fails
This commit is contained in:
@@ -1239,7 +1239,9 @@ static void btu_hcif_command_complete_evt(BT_HDR *response, void *context)
|
||||
|
||||
event->event = BTU_POST_TO_TASK_NO_GOOD_HORRIBLE_HACK;
|
||||
|
||||
btu_task_post(SIG_BTU_HCI_MSG, event, OSI_THREAD_MAX_TIMEOUT);
|
||||
if (btu_task_post(SIG_BTU_HCI_MSG, event, OSI_THREAD_MAX_TIMEOUT) == false) {
|
||||
osi_free(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1469,7 +1471,9 @@ static void btu_hcif_command_status_evt(uint8_t status, BT_HDR *command, void *c
|
||||
|
||||
event->event = BTU_POST_TO_TASK_NO_GOOD_HORRIBLE_HACK;
|
||||
|
||||
btu_task_post(SIG_BTU_HCI_MSG, event, OSI_THREAD_MAX_TIMEOUT);
|
||||
if (btu_task_post(SIG_BTU_HCI_MSG, event, OSI_THREAD_MAX_TIMEOUT) == false) {
|
||||
osi_free(event);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user