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-3.1.0~314^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c40b2d97829ce2afea4eed9cb4eac40ccec82e5;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 597233908..b436b6a3f 100644 --- a/src/lxc/execute.c +++ b/src/lxc/execute.c @@ -57,6 +57,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) { SYSERROR("Allocating init args failed");