mirror of
https://github.com/apache/nuttx.git
synced 2026-09-26 09:54:24 +08:00
sched/mqueue: reclaim message upon failure
This reclaims the allocated message if it can't be sent to avoid memory leaks. Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
4197b5aec8
commit
0fc2e74b04
@@ -268,6 +268,12 @@ file_mq_timedsend_internal(FAR struct file *mq, FAR const char *msg,
|
||||
out_send_message:
|
||||
ret = nxmq_do_send(msgq, mqmsg, msg, msglen, prio);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* free the message as it can't be sent */
|
||||
|
||||
nxmq_free_msg(mqmsg);
|
||||
}
|
||||
|
||||
/* Exit here with (1) the scheduler locked, (2) a message allocated, (3) a
|
||||
* wdog allocated, and (4) interrupts disabled.
|
||||
|
||||
Reference in New Issue
Block a user