Skip to content

Commit

Permalink
dir: use cleanup macro in dir_mount()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner authored and stgraber committed Mar 26, 2020
1 parent 039f2a9 commit 53209ca
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/lxc/storage/dir.c
Expand Up @@ -138,7 +138,7 @@ bool dir_detect(const char *path)

int dir_mount(struct lxc_storage *bdev)
{
char *mntdata = NULL;
__do_free char *mntdata = NULL;
unsigned long mflags = 0, mntflags = 0, pflags = 0;
int ret;
const char *src;
Expand All @@ -152,14 +152,12 @@ int dir_mount(struct lxc_storage *bdev)
ret = parse_mntopts(bdev->mntopts, &mntflags, &mntdata);
if (ret < 0) {
ERROR("Failed to parse mount options \"%s\"", bdev->mntopts);
free(mntdata);
return -EINVAL;
}

ret = parse_propagationopts(bdev->mntopts, &pflags);
if (ret < 0) {
ERROR("Failed to parse propagation options \"%s\"", bdev->mntopts);
free(mntdata);
return -EINVAL;
}

Expand All @@ -175,12 +173,10 @@ int dir_mount(struct lxc_storage *bdev)

if (ret < 0) {
SYSERROR("Failed to mount \"%s\" on \"%s\"", src, bdev->dest);
free(mntdata);
return -1;
}

TRACE("Mounted \"%s\" on \"%s\"", src, bdev->dest);
free(mntdata);
return ret;
}

Expand Down

0 comments on commit 53209ca

Please sign in to comment.