Re: [PATCH] ovl: Fix a potential memory leak for kstrdup()
From: Miklos Szeredi
Date: Wed Jul 27 2022 - 09:29:29 EST
On Wed, 13 Jul 2022 at 09:33, <williamsukatube@xxxxxxx> wrote:
>
> From: William Dean <williamsukatube@xxxxxxxxx>
>
> kfree() is missing on an error path to free the memory
> allocated by kstrdup():
>
> config->redirect_mode = kstrdup(ovl_redirect_mode_def(), GFP_KERNEL);
>
> So it is better to free it via kfree(config->redirect_mode).
Will be freed in ovl_free_fs().
Thanks,
Miklos