Message ID | 1440689898-35178-3-git-send-email-bhlee.kernel@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Fri, Aug 28, 2015 at 12:38:17AM +0900, Byongho Lee wrote: > 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> Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/btrfs-map-logical.c b/btrfs-map-logical.c index a88e56e39dbb..d9fa6b29d3c9 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;
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> --- btrfs-map-logical.c | 2 ++ 1 file changed, 2 insertions(+)