From: Dan Carpenter Date: Fri, 12 Oct 2012 04:22:43 +0000 (+1100) Subject: memstick: memory leak on error in msb_ftl_scan() X-Git-Tag: next-20121018~3^2~66 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=945dc1dfc360c99b0bda9da49a421949a2161f97;p=karo-tx-linux.git memstick: memory leak on error in msb_ftl_scan() We need to free "overwrite_flags" before returning. Signed-off-by: Dan Carpenter Acked-by: Maxim Levitsky Cc: Jens Axboe Signed-off-by: Andrew Morton --- diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c index 4a751c9e5eff..af191797b363 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;