]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-start: fix the container leak when daemonize
authorQiang Huang <h.huangqiang@huawei.com>
Sat, 18 Jan 2014 06:59:58 +0000 (14:59 +0800)
committerStéphane Graber <stgraber@ubuntu.com>
Sun, 19 Jan 2014 00:57:39 +0000 (19:57 -0500)
When start container with daemon model, we'll have a new daemon
process in lxcapi_start, whose c->numthreads is 2, inherited
from his father. Even his father return to main(), the
lxc_container_put won't affect son's numthreads.

So when daemon stops, he should return to main and do
lxc_container_put again, rather than exit and leave the
container alone.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/lxccontainer.c

index 0bebdff1b015ae060e413262bacefb8d0d22cacf..ddea0d72d1eb9f2604faaa4def4ee2e7d7ed416b 100644 (file)
@@ -632,12 +632,10 @@ reboot:
                goto reboot;
        }
 
-       if (daemonize) {
+       if (daemonize)
                lxc_container_put(c);
-               exit (ret == 0 ? true : false);
-       } else {
-               return (ret == 0 ? true : false);
-       }
+       
+       return (ret == 0 ? true : false);
 }
 
 /*