]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
memstick: memory leak on error in msb_ftl_scan()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 25 Oct 2012 01:14:35 +0000 (12:14 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 1 Nov 2012 04:23:57 +0000 (15:23 +1100)
We need to free "overwrite_flags" before returning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Maxim Levitsky <maximlevitsly@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/memstick/core/ms_block.c

index 4a751c9e5eff2e7e2054a85cf47bf1ba3b4a01f0..af191797b36369ee74c068c09cfe8ae5d4366dbd 100644 (file)
@@ -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;