Skip to content

Commit

Permalink
UBI: fix memory leak in checking code
Browse files Browse the repository at this point in the history
Reported-by: Eric Sesterhenn / Snakebyte <snakebyte@gmx.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Jul 18, 2007
1 parent cb32da0 commit 341e1a0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/mtd/ubi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 341e1a0

Please sign in to comment.