From: Byongho Lee Date: Thu, 27 Aug 2015 15:38:17 +0000 (+0900) Subject: btrfs-progs: fix memory leak in btrfs-map-logical main() X-Git-Tag: upstream/4.16.1~2057 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e381418904027a9f968e97403add5bda03fb319;p=platform%2Fupstream%2Fbtrfs-progs.git 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 Signed-off-by: David Sterba --- diff --git a/btrfs-map-logical.c b/btrfs-map-logical.c index a88e56e..d9fa6b2 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;