userspace: plug thread index leak in k_object_alloc()
The thread index should be freed when the object allocation fails. Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
parent
e65e261621
commit
962b374129
1 changed files with 3 additions and 0 deletions
|
@ -361,6 +361,9 @@ void *z_impl_k_object_alloc(enum k_objects otype)
|
|||
zo = z_dynamic_object_aligned_create(obj_align_get(otype),
|
||||
obj_size_get(otype));
|
||||
if (zo == NULL) {
|
||||
if (otype == K_OBJ_THREAD) {
|
||||
thread_idx_free(tidx);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
zo->type = otype;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue