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>
master
Byongho Lee 2015-08-28 00:38:17 +09:00 committed by David Sterba
parent abe48ca860
commit 6e38141890
1 changed files with 2 additions and 0 deletions

View File

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