Re: [PATCH 1/2] ubifs: xattr: Fix some potential memory leaks while iterating entries

From: Richard Weinberger
Date: Sun Sep 13 2020 - 15:08:24 EST


On Mon, Jun 1, 2020 at 11:11 AM Zhihao Cheng <chengzhihao1@xxxxxxxxxx> wrote:
>
> Fix some potential memory leaks in error handling branches while
> iterating xattr entries. For example, function ubifs_tnc_remove_ino()
> forgets to free pxent if it exists. Similar problems also exist in
> ubifs_purge_xattrs(), ubifs_add_orphan() and ubifs_jnl_write_inode().
>
> Signed-off-by: Zhihao Cheng <chengzhihao1@xxxxxxxxxx>
> Cc: <Stable@xxxxxxxxxxxxxxx>
> Fixes: 1e51764a3c2ac05a2 ("UBIFS: add new flash file system")

I agree that this needs fixing. Did you also look into getting rid of pxent?
UBIFS uses the pxent pattern over and over and the same error got copy pasted
a lot. :-(

--
Thanks,
//richard