diff options
author | Byongho Lee <bhlee.kernel@gmail.com> | 2015-08-28 00:38:17 +0900 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2015-08-31 19:25:14 +0200 |
commit | 6e381418904027a9f968e97403add5bda03fb319 (patch) | |
tree | 6e5e92e97642062ec61a7cae60a425993565555a /btrfs-map-logical.c | |
parent | abe48ca8600be7c8a7ec3c018b449ad3bd56c7a4 (diff) |
btrfs-progs: fix memory leak in btrfs-map-logical main()
In btrfs-map-logical main(), strdup() allocates memory to output_file,
but that memory is not freed.
So add missing free() calls before return.
Signed-off-by: Byongho Lee <bhlee.kernel@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'btrfs-map-logical.c')
-rw-r--r-- | btrfs-map-logical.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/btrfs-map-logical.c b/btrfs-map-logical.c index a88e56e3..d9fa6b29 100644 --- a/btrfs-map-logical.c +++ b/btrfs-map-logical.c @@ -262,6 +262,7 @@ int main(int ac, char **av) root = open_ctree(dev, 0, 0); if (!root) { fprintf(stderr, "Open ctree failed\n"); + free(output_file); exit(1); } @@ -354,6 +355,7 @@ out_close_fd: if (output_file && out_fd != 1) close(out_fd); close: + free(output_file); close_ctree(root); if (ret < 0) ret = 1; |