diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2007-05-03 10:59:51 +0200 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2007-07-18 15:52:13 +0200 |
commit | 341e1a0cf2d8965c8b2f7941a6b2f2c2170df469 (patch) | |
tree | b0ad5795c32d16e8c198c6177d992a21fde20be5 /drivers/mtd | |
parent | slob: Kill off duplicate kzalloc() definition. (diff) | |
download | linux-341e1a0cf2d8965c8b2f7941a6b2f2c2170df469.tar.xz linux-341e1a0cf2d8965c8b2f7941a6b2f2c2170df469.zip |
UBI: fix memory leak in checking code
Reported-by: Eric Sesterhenn / Snakebyte <snakebyte@gmx.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/ubi/scan.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index 473f3200b868..e4456869e753 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c @@ -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; } |