From: Dan Carpenter Date: Thu, 25 Oct 2012 01:14:35 +0000 (+1100) Subject: memstick: memory leak on error in msb_ftl_scan() X-Git-Tag: next-20121101~1^2~156 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ef221bd1070b74eba4541ef59e544d22557d2dce;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;