From d95cd749e6e9485b2d32eb0586c83b0ff8679f31 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 12 Oct 2012 15:22:43 +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