[PATCH] erofs-utils: lib: fix memory leak in xattr handling

Gao Xiang hsiangkao at linux.alibaba.com
Tue Jul 15 12:39:56 AEST 2025


Hi Chao,

On 2025/7/15 10:35, Chao Yu wrote:
> 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>

I released erofs-utils 1.8.10 hours ago to resolve some
fragment mkfs regression so it won't be in appended.

But thanks for your review!

Thanks,
Gao Xiang

> 
> Thanks,



More information about the Linux-erofs mailing list