storage: remove stack allocations

parent 4ffeaf27
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include "lvm.h" #include "lvm.h"
#include "lxc.h" #include "lxc.h"
#include "lxclock.h" #include "lxclock.h"
#include "memory_utils.h"
#include "namespace.h" #include "namespace.h"
#include "nbd.h" #include "nbd.h"
#include "overlay.h" #include "overlay.h"
...@@ -567,13 +568,11 @@ struct lxc_storage *storage_create(const char *dest, const char *type, ...@@ -567,13 +568,11 @@ struct lxc_storage *storage_create(const char *dest, const char *type,
/* -B lvm,dir */ /* -B lvm,dir */
if (strchr(type, ',')) { if (strchr(type, ',')) {
char *dup, *token; __do_free char *dup;
char *token;
size_t len; size_t len;
len = strlen(type); dup = must_copy_string(type);
dup = alloca(len + 1);
(void)strlcpy(dup, type, len + 1);
lxc_iterate_parts(token, dup, ",") { lxc_iterate_parts(token, dup, ",") {
bdev = do_storage_create(dest, token, cname, specs); bdev = do_storage_create(dest, token, cname, specs);
if (bdev) if (bdev)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment