mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-14 11:39:56 +00:00
Free allocated memory on failure (v2)
Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
2b54359b24
commit
196a808645
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user