mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 06:33:34 +08:00
fix px4_task_spawn_cmd: unlock mutex if pthread_create fails
This commit is contained in:
@@ -240,11 +240,13 @@ px4_task_t px4_task_spawn_cmd(const char *name, int scheduler, int priority, int
|
||||
if (rv != 0) {
|
||||
PX4_ERR("px4_task_spawn_cmd: failed to create thread %d %d\n", rv, errno);
|
||||
taskmap[taskid].isused = false;
|
||||
pthread_mutex_unlock(&task_mutex);
|
||||
free(taskdata);
|
||||
return (rv < 0) ? rv : -rv;
|
||||
}
|
||||
|
||||
} else {
|
||||
pthread_mutex_unlock(&task_mutex);
|
||||
free(taskdata);
|
||||
return (rv < 0) ? rv : -rv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user