UBI: fix dereference after kfree

Coverity (CID 1614) spotted new_seb being dereferenced after kfree() in
create_vtbl's write_error path.

Signed-off-by: Florin Malita <fmalita@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
Florin Malita 2007-05-03 11:49:57 -04:00 committed by Artem Bityutskiy
parent 341e1a0cf2
commit c4e90ec013

View File

@ -317,14 +317,13 @@ retry:
return err; return err;
write_error: write_error:
kfree(new_seb); /* Maybe this physical eraseblock went bad, try to pick another one */
/* May be this physical eraseblock went bad, try to pick another one */ if (++tries <= 5)
if (++tries <= 5) {
err = ubi_scan_add_to_list(si, new_seb->pnum, new_seb->ec, err = ubi_scan_add_to_list(si, new_seb->pnum, new_seb->ec,
&si->corr); &si->corr);
if (!err) kfree(new_seb);
goto retry; if (!err)
} goto retry;
out_free: out_free:
ubi_free_vid_hdr(ubi, vid_hdr); ubi_free_vid_hdr(ubi, vid_hdr);
return err; return err;