Re: [PATCH v4 02/19] selftests/resctrl: Don't leak buffer in fill_cache()

From: Reinette Chatre
Date: Thu Jul 13 2023 - 18:44:57 EST


Hi Ilpo,

On 7/13/2023 6:19 AM, Ilpo Järvinen wrote:
> The error path in fill_cache() does return before the allocated buffer
> is freed leaking the buffer.
>
> The leak was introduced when fill_cache_read() started to return errors
> in c7b607fa9325 ("selftests/resctrl: Fix null pointer dereference on

Could you please prefix the sha with "commit" to get a clean
checkpatch.pl check?

> open failed"), before that both fill functions always returned 0.
>
> Move free() earlier to prevent the mem leak.
>
> Fixes: c7b607fa9325 ("selftests/resctrl: Fix null pointer dereference on open failed")
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>

Thank you for catching this.

With the changelog update:

Reviewed-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>

Reinette