Commit 3c41dd05 by Christian Brauner Committed by Stéphane Graber

Free allocated memory on failure (v2)

parent 4f09d6c2
......@@ -2461,12 +2461,15 @@ static int overlayfs_clonepaths(struct bdev *orig, struct bdev *new, const char
// and needs to be on the same filesystem as upperdir,
// so it's OK for it to be empty.
work = malloc(lastslashidx + 7);
if (!work)
if (!work) {
free(delta);
return -1;
}
strncpy(work, new->dest, lastslashidx+1);
strcpy(work+lastslashidx, "olwork");
if (mkdir(work, 0755) < 0) {
SYSERROR("error: mkdir %s", work);
free(delta);
free(work);
return -1;
}
......
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