Assign used_msg as soon as message start to be read.
@@ -738,9 +738,9 @@ error_return_t MsgAlloc_PullMsgFromLuosTask(uint16_t luos_task_id, msg_t **retur
//find the oldest message allocated to this module
if (luos_task_id < luos_tasks_stack_id)
{
- *returned_msg = luos_tasks[luos_task_id].msg_pt;
+ used_msg = luos_tasks[luos_task_id].msg_pt;
+ *returned_msg = (msg_t *)used_msg;
// Clear the slot by sliding others to the left on it
- used_msg = *returned_msg;
MsgAlloc_ClearLuosTask(luos_task_id);
return SUCCEED;
}
