Re: [PATCH] isofs: avoid memory leak in iocharset
From: Eric Sandeen
Date: Wed Nov 06 2024 - 14:00:13 EST
On 11/6/24 2:28 AM, Hao Ge wrote:
> From: Hao Ge <gehao@xxxxxxxxxx>
...
> The opt->iocharset is freed inside the isofs_fill_super function,
> But there may be situations where it's not possible to
> enter this function.
>
> For example, in the get_tree_bdev_flags function,when
> encountering the situation where "Can't mount, would change RO state,"
> In such a case, isofs_fill_super will not have the opportunity
> to be called,which means that opt->iocharset will not have the chance
> to be freed,ultimately leading to a memory leak.
>
> Let's move the memory freeing of opt->iocharset into
> isofs_free_fc function.
>
> Fixes: 1b17a46c9243 ("isofs: convert isofs to use the new mount API")
> Signed-off-by: Hao Ge <gehao@xxxxxxxxxx>
Agreed, thank you.
Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxx>