From: Qiang Huang Date: Sat, 18 Jan 2014 06:59:58 +0000 (+0800) Subject: lxc-start: fix the container leak when daemonize X-Git-Tag: lxc-1.0.0.beta3~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3f0f139e155f53c83e0a81f14094e9d0f40e8e9;p=thirdparty%2Flxc.git lxc-start: fix the container leak when daemonize 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 Acked-by: Stéphane Graber --- diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 0bebdff1b..ddea0d72d 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -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); } /*