Commit 6d71a43e authored by Jan Kiszka's avatar Jan Kiszka Committed by Philippe Gerum

cobalt/posix/sem: Fix semaphore leak on failing xnmalloc

Properly destroy the semaphore in case we cannot allocate a
cobalt_named_sem struct.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <>
parent 50ef0051
......@@ -125,8 +125,10 @@ sem_open(struct cobalt_process *process,
u = xnmalloc(sizeof(*u));
if (u == NULL)
if (u == NULL) {
return ERR_PTR(-ENOMEM);
u->sem = sem;
u->usem = ushadow;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment