UBI: fix memory leak in checking code
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Thu, 3 May 2007 08:59:51 +0000 (11:59 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 18 Jul 2007 13:52:13 +0000 (16:52 +0300)
Reported-by: Eric Sesterhenn / Snakebyte <snakebyte@gmx.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
drivers/mtd/ubi/scan.c

index 473f320..e445686 100644 (file)
@@ -1310,8 +1310,10 @@ static int paranoid_check_si(const struct ubi_device *ubi,
        memset(buf, 1, ubi->peb_count);
        for (pnum = 0; pnum < ubi->peb_count; pnum++) {
                err = ubi_io_is_bad(ubi, pnum);
-               if (err < 0)
+               if (err < 0) {
+                       kfree(buf);
                        return err;
+               }
                else if (err)
                        buf[pnum] = 0;
        }