Re: [patch 2/2] memstick: memory leak on error in msb_ftl_scan()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2012-09-29 at 10:11 +0300, Dan Carpenter wrote: 
> We need to free "overwrite_flags" before returning.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
> index a8e8915..1f9d5cf 100644
> --- a/drivers/memstick/core/ms_block.c
> +++ b/drivers/memstick/core/ms_block.c
> @@ -1408,8 +1408,10 @@ static int msb_ftl_scan(struct msb_data *msb)
>  			msb_mark_block_used(msb, pba);
>  			msb_erase_block(msb, pba);
>  			continue;
> -		} else if (error)
> +		} else if (error) {
> +			kfree(overwrite_flags);
>  			return error;
> +		}
>  
>  		lba = be16_to_cpu(extra.logical_address);
>  		managment_flag = extra.management_flag;

Indeed. I need to be more careful with this,
I'll do another review of the code, maybe I spot anything else.

Acked-by: Maxim Levitsky <maximlevitsly@xxxxxxxxx>

Best regards,
Maxim Levitsky

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux