UBI: Fix memory leak in ubi_attach_fastmap() error path
On error we have to free all three temporary lists. Reported-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
dee73c54b0
commit
71791bd2cb
|
@ -830,6 +830,19 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
|
||||||
fail_bad:
|
fail_bad:
|
||||||
ret = UBI_BAD_FASTMAP;
|
ret = UBI_BAD_FASTMAP;
|
||||||
fail:
|
fail:
|
||||||
|
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &used, u.list) {
|
||||||
|
free(tmp_aeb);
|
||||||
|
list_del(&tmp_aeb->u.list);
|
||||||
|
}
|
||||||
|
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &eba_orphans, u.list) {
|
||||||
|
free(tmp_aeb);
|
||||||
|
list_del(&tmp_aeb->u.list);
|
||||||
|
}
|
||||||
|
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &lfree, u.list) {
|
||||||
|
free(tmp_aeb);
|
||||||
|
list_del(&tmp_aeb->u.list);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue