From: Tycho Andersen Date: Wed, 9 May 2018 01:29:06 +0000 (+0000) Subject: execute: account for -o path option count X-Git-Tag: lxc-2.0.10~152 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15dbf0a01d752a2420817c2c39e38aa8d79e4c25;p=thirdparty%2Flxc.git execute: account for -o path option count This always works fine... until your exec() fails and you try to go and free it, you've overwritten the allocator's metadata (and potentially other stuff) and it fails. Signed-off-by: Tycho Andersen --- diff --git a/src/lxc/execute.c b/src/lxc/execute.c index ba73b6b9e..d5edf7a33 100644 --- a/src/lxc/execute.c +++ b/src/lxc/execute.c @@ -64,6 +64,9 @@ static int execute_start(struct lxc_handler *handler, void* data) if (lxc_log_has_valid_level()) argc_add += 2; + if (current_config->logfd != -1 || lxc_log_fd != -1) + argc_add += 2; + argv = malloc((argc + argc_add) * sizeof(*argv)); if (!argv) goto out1;