#include "config.h"
#include "log.h"
#include "loop.h"
+#include "memory_utils.h"
#include "storage.h"
#include "storage_utils.h"
#include "utils.h"
const char *lxcpath, int snap, uint64_t newsize,
struct lxc_conf *conf)
{
+ __do_free char *srcdev = NULL;
uint64_t size = newsize;
int len, ret;
- char *srcdev;
char fstype[100] = "ext4";
if (snap) {
return -1;
len = strlen(lxcpath) + strlen(cname) + strlen("rootdev") + 3;
- srcdev = alloca(len);
+ srcdev = must_realloc(NULL, len);
ret = snprintf(srcdev, len, "%s/%s/rootdev", lxcpath, cname);
if (ret < 0 || ret >= len) {
ERROR("Failed to create string");
int loop_create(struct lxc_storage *bdev, const char *dest, const char *n,
struct bdev_specs *specs)
{
+ __do_free char *srcdev;
const char *fstype;
uint64_t sz;
int ret, len;
- char *srcdev;
if (!specs)
return -1;
* be <lxcpath>/<lxcname>/rootdev, and <src> will be "loop:<srcdev>".
*/
len = strlen(dest) + 2;
- srcdev = alloca(len);
+ srcdev = must_realloc(NULL, len);
ret = snprintf(srcdev, len, "%s", dest);
if (ret < 0 || ret >= len) {