Re: [PATCH] staging: vt6655: fix potential memory leak

From: Dan Carpenter
Date: Mon Sep 12 2022 - 09:25:44 EST


On Fri, Sep 09, 2022 at 04:13:39PM +0200, Nam Cao wrote:
> In function device_init_td0_ring, memory is allocated for member
> td_info of priv->apTD0Rings[i], with i increasing from 0. In case of
> allocation failure, the memory is freed in reversed order, with i
> decreasing to 0. However, the case i=0 is left out and thus memory is
> leaked.
>
> Modify the memory freeing loop to include the case i=0.
>
> Signed-off-by: Nam Cao <namcaov@xxxxxxxxx>

Looks good. Please add a Fixes tag, and CC all the people who were
involved with the original patch so they can review it.

Fixes: 5341ee0adb17 ("staging: vt6655: check for memory allocation failures")

I actually wrote that buggy code and Ji-Hun copied it from me, so my
bad. Sorry!

regards,
dan carpenter