summaryrefslogtreecommitdiff
path: root/cmds-subvolume.c
diff options
context:
space:
mode:
authorZach Brown <zab@redhat.com>2013-01-23 15:18:14 -0800
committerZach Brown <zab@redhat.com>2013-02-05 16:09:40 -0800
commitbf4196b408f963e335a3dccdcc8d6ab52985e996 (patch)
tree73b2e0336d33d1f557300d8e49d984dde023f861 /cmds-subvolume.c
parentceb538f178b2407a25458b40c134aa5816e7b5c6 (diff)
btrfs-progs: don't leak inherit on errors
A few paths returned errors before freeing their inherit allocation. Signed-off-by: Zach Brown <zab@redhat.com>
Diffstat (limited to 'cmds-subvolume.c')
-rw-r--r--cmds-subvolume.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index a87bcc5a..af04a6b8 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -158,13 +158,13 @@ static int cmd_subvol_create(int argc, char **argv)
e = errno;
close(fddst);
+ free(inherit);
if(res < 0 ){
fprintf( stderr, "ERROR: cannot create subvolume - %s\n",
strerror(e));
return 11;
}
- free(inherit);
return 0;
}
@@ -604,13 +604,13 @@ static int cmd_snapshot(int argc, char **argv)
close(fd);
close(fddst);
+ free(inherit);
if(res < 0 ){
fprintf( stderr, "ERROR: cannot snapshot '%s' - %s\n",
subvol, strerror(e));
return 11;
}
- free(inherit);
return 0;
}