From: Christian Brauner Date: Tue, 5 Feb 2019 06:32:21 +0000 (+0100) Subject: storage: remove stack allocations X-Git-Tag: lxc-3.2.0~164^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=643c9ec99462c1e33efd076fbe26d6308357c82a;p=thirdparty%2Flxc.git storage: remove stack allocations Signed-off-by: Christian Brauner --- diff --git a/src/lxc/storage/storage.c b/src/lxc/storage/storage.c index 837e8cabe..4cff0a1a4 100644 --- a/src/lxc/storage/storage.c +++ b/src/lxc/storage/storage.c @@ -51,6 +51,7 @@ #include "lvm.h" #include "lxc.h" #include "lxclock.h" +#include "memory_utils.h" #include "namespace.h" #include "nbd.h" #include "overlay.h" @@ -567,13 +568,11 @@ struct lxc_storage *storage_create(const char *dest, const char *type, /* -B lvm,dir */ if (strchr(type, ',')) { - char *dup, *token; + __do_free char *dup; + char *token; size_t len; - len = strlen(type); - dup = alloca(len + 1); - (void)strlcpy(dup, type, len + 1); - + dup = must_copy_string(type); lxc_iterate_parts(token, dup, ",") { bdev = do_storage_create(dest, token, cname, specs); if (bdev)