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

From: SJ Park

Date: Wed Aug 26 2026 - 20:31:24 EST


On Wed, 26 Aug 2026 11:43:00 +0530 Anshuman <anshumantewari123@xxxxxxxxx> 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.

Makes sense to me.

>
> Signed-off-by: Anshuman <anshumantewari123@xxxxxxxxx>

Reviewed-by: SJ Park <sj@xxxxxxxxxx>


Thanks,
SJ

[...]