Commit bdb539b8 by Serge Hallyn

lxclock: fix coverity-found leak

if sem_init fails, free what we mallocd. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent 87677950
...@@ -58,8 +58,10 @@ static sem_t *lxc_new_unnamed_sem(void) ...@@ -58,8 +58,10 @@ static sem_t *lxc_new_unnamed_sem(void)
if (!s) if (!s)
return NULL; return NULL;
ret = sem_init(s, 0, 1); ret = sem_init(s, 0, 1);
if (ret) if (ret) {
free(s);
return NULL; return NULL;
}
return s; return s;
} }
......
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