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>
This commit is contained in:
Zach Brown 2013-01-23 15:18:14 -08:00
parent ceb538f178
commit bf4196b408
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}