[PATCH] erofs-utils: lib: fix memory leak in xattr handling
Chao Yu
chao at kernel.org
Tue Jul 15 12:35:21 AEST 2025
On 7/12/25 07:35, Sandeep Dhavale wrote:
> In android the LeakSanitizer reported memory leaks originating
> from functions like erofs_get_selabel_xattr.
>
> The root cause is that the 'kvbuf' buffer, which is allocated to
> store xattr data, was not being freed when its owning
> 'xattr_item' struct was deallocated. The functions put_xattritem()
> and erofs_cleanxattrs() were freeing the xattr_item struct but
> neglected to free the kvbuf pointer within it.
>
> This patch fixes the leak by adding the necessary free() calls for
> kvbuf in both functions.
>
> Signed-off-by: Sandeep Dhavale <dhavale at google.com>
Reviewed-by: Chao Yu <chao at kernel.org>
Thanks,
More information about the Linux-erofs
mailing list