]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxclock: fix coverity-found leak
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 12 Apr 2013 20:11:29 +0000 (15:11 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 12 Apr 2013 20:11:29 +0000 (15:11 -0500)
if sem_init fails, free what we mallocd.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxclock.c

index 88a388182617939d3e450fa52610f03c7234442f..0cbe843a10f7f75f8d994492f66382b68fa29ea4 100644 (file)
@@ -58,8 +58,10 @@ static sem_t *lxc_new_unnamed_sem(void)
        if (!s)
                return NULL;
        ret = sem_init(s, 0, 1);
-       if (ret)
+       if (ret) {
+               free(s);
                return NULL;
+       }
        return s;
 }