From: Christian Brauner Date: Tue, 5 Feb 2019 06:25:12 +0000 (+0100) Subject: start: remove stack allocations X-Git-Tag: lxc-3.2.0~164^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ffeaf276693f05a609b73f8141113dce4cf6b92;p=thirdparty%2Flxc.git start: remove stack allocations Signed-off-by: Christian Brauner --- diff --git a/src/lxc/start.c b/src/lxc/start.c index 91f1e51b7..b4bb6ef9a 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -26,7 +26,6 @@ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#include #include #include #include @@ -67,6 +66,7 @@ #include "lxcseccomp.h" #include "macro.h" #include "mainloop.h" +#include "memory_utils.h" #include "monitor.h" #include "namespace.h" #include "network.h" @@ -97,16 +97,13 @@ static void lxc_destroy_container_on_signal(struct lxc_handler *handler, static void print_top_failing_dir(const char *path) { + __do_free char *copy; int ret; - size_t len; - char *copy, *e, *p, saved; - - len = strlen(path); - copy = alloca(len + 1); - (void)strlcpy(copy, path, len + 1); + char *e, *p, saved; + copy = must_copy_string(path); p = copy; - e = copy + len; + e = copy + strlen(path); while (p < e) { while (p < e && *p == '/')