[HUST CSE IoTS&P Lab] [fix] check rt_mutex_create return value (#7169)

This commit is contained in:
Sparks-Pion
2023-04-04 00:33:10 -04:00
committed by GitHub
parent 3bee170d52
commit accab17fa5
6 changed files with 31 additions and 3 deletions
+2
View File
@@ -1016,6 +1016,8 @@ rt_err_t sys_sem_release(rt_sem_t sem)
rt_mutex_t sys_mutex_create(const char *name, rt_uint8_t flag)
{
rt_mutex_t mutex = rt_mutex_create(name, flag);
if(mutex == NULL)
return NULL;
if (lwp_user_object_add(lwp_self(), (rt_object_t)mutex) != 0)
{
rt_mutex_delete(mutex);