diff mbox

[3/6] btrfs-progs: free fslabel for btrfs-convert

Message ID 923885cdd32d06b2bf4446b32b91917618f3be78.1446111097.git.zhaolei@cn.fujitsu.com (mailing list archive)
State Rejected
Headers show

Commit Message

Zhaolei Oct. 29, 2015, 9:31 a.m. UTC
fslabel need to be freed before exit.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 btrfs-convert.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

David Sterba Oct. 29, 2015, 1:08 p.m. UTC | #1
On Thu, Oct 29, 2015 at 05:31:45PM +0800, Zhao Lei wrote:
> fslabel need to be freed before exit.
> 
> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
> ---
>  btrfs-convert.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/btrfs-convert.c b/btrfs-convert.c
> index 5b9171e..1693d03 100644
> --- a/btrfs-convert.c
> +++ b/btrfs-convert.c
> @@ -3027,6 +3027,9 @@ int main(int argc, char *argv[])
>  		ret = do_convert(file, datacsum, packing, noxattr, nodesize,
>  				copylabel, fslabel, progress, features);
>  	}
> +
> +	free(fslabel);

fslabel is on stack:

btrfs-convert.c: In function 'main':
btrfs-convert.c:3031:6: warning: attempt to free a non-heap object 'fslabel' [-Wfree-nonheap-object]
--
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 mbox

Patch

diff --git a/btrfs-convert.c b/btrfs-convert.c
index 5b9171e..1693d03 100644
--- a/btrfs-convert.c
+++ b/btrfs-convert.c
@@ -3027,6 +3027,9 @@  int main(int argc, char *argv[])
 		ret = do_convert(file, datacsum, packing, noxattr, nodesize,
 				copylabel, fslabel, progress, features);
 	}
+
+	free(fslabel);
+
 	if (ret)
 		return 1;
 	return 0;