UBI: fix memory leak in checking code

Reported-by: Eric Sesterhenn / Snakebyte <snakebyte@gmx.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
Artem Bityutskiy 2007-05-03 11:59:51 +03:00
parent cb32da0416
commit 341e1a0cf2

View 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;
}