From 39fc62b5970d79b98cdc27bbae2e32a30aa39076 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sat, 3 Nov 2012 11:41:59 +1100 Subject: [PATCH] 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 --- drivers/memstick/core/ms_block.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.39.5