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:
parent
ceb538f178
commit
bf4196b408
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue