mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-11 16:29:42 +00:00
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>
This commit is contained in:
parent
abe48ca860
commit
6e38141890
@ -262,6 +262,7 @@ int main(int ac, char **av)
|
|||||||
root = open_ctree(dev, 0, 0);
|
root = open_ctree(dev, 0, 0);
|
||||||
if (!root) {
|
if (!root) {
|
||||||
fprintf(stderr, "Open ctree failed\n");
|
fprintf(stderr, "Open ctree failed\n");
|
||||||
|
free(output_file);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,6 +355,7 @@ out_close_fd:
|
|||||||
if (output_file && out_fd != 1)
|
if (output_file && out_fd != 1)
|
||||||
close(out_fd);
|
close(out_fd);
|
||||||
close:
|
close:
|
||||||
|
free(output_file);
|
||||||
close_ctree(root);
|
close_ctree(root);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user