diff options
author | 2010-01-12 12:26:42 +0200 | |
---|---|---|
committer | 2010-02-01 15:16:36 +0200 | |
commit | 0bf1c4399afee6a2031b0ee943a4c016e53f727c (patch) | |
tree | c5d7a62b2c965e65a42f17f6206c28f3c4e57a81 /lib/debugobjects.c | |
parent | UBI: support attaching by MTD character device name (diff) | |
download | wireguard-linux-0bf1c4399afee6a2031b0ee943a4c016e53f727c.tar.xz wireguard-linux-0bf1c4399afee6a2031b0ee943a4c016e53f727c.zip |
UBI: fix attaching error path
In the error path of 'ubi_attach_mtd_dev()' we have a tricky situation:
we have to release things differently depending on at which point
the failure happening. Namely, if @ubi->dev is not initialized, we have
to free everything ourselves. But if it was, we should not free the @ubi
object, because it will be freed in the 'dev_release()' function. And
we did not get this situation right.
This patch introduces additional argument to the 'uif_init()' function.
On exit, this argument indicates whether the final 'free(ubi)' will
happen in 'dev_release()' or not. So the caller always knows how to
properly release the resources.
Impact: all memory is now correctly released when UBI fails to attach
an MTD device.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'lib/debugobjects.c')
0 files changed, 0 insertions, 0 deletions