Re: [PATCH] selftests/mm: fix line buffer leak in mremap_test is_range_mapped()

From: David Hildenbrand (Arm)

Date: Wed Aug 26 2026 - 03:40:23 EST


On 8/26/26 08:13, Anshuman wrote:
> is_range_mapped() uses getline() to read /proc/self/maps line by
> line, but never frees the buffer it allocates. Every exit path
> (parse failure, match found, or reaching EOF) returns without
> calling free(line), leaking the buffer on each call. The function
> is called multiple times in this test, so the leak accumulates
> across calls.
>
> Free line before returning.
>
> Signed-off-by: Anshuman <anshumantewari123@xxxxxxxxx>
> ---

Looks good, I don't think Fixes is needed (even though called multiple times,
the effective waste should not be relevant on any realistic system).

Thanks!

Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

--
Cheers,

David