From bf4196b408f963e335a3dccdcc8d6ab52985e996 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 23 Jan 2013 15:18:14 -0800 Subject: [PATCH] btrfs-progs: don't leak inherit on errors A few paths returned errors before freeing their inherit allocation. Signed-off-by: Zach Brown --- cmds-subvolume.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index a87bcc5..af04a6b 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; } -- 2.7.4