diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2015-05-06 12:32:12 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-05-07 09:49:42 +0200 |
commit | e5dda9d5e2f27bc8cabf8f4915fadad8112e5f8b (patch) | |
tree | 7222ab3e382ae0a4b6e1fcbaeb30be655c429816 /lib | |
parent | 835ffe76c46cdd97a3d1f1d75bca593185db083a (diff) | |
download | barebox-e5dda9d5e2f27bc8cabf8f4915fadad8112e5f8b.tar.gz barebox-e5dda9d5e2f27bc8cabf8f4915fadad8112e5f8b.tar.xz |
bootstrap_read_devfs(): Remove all partitions upon function completion
Bootstrap_read_devfs does not remove the devices it creates during the
course of its execution which might be considered as a resource
leak. Remedy that by adding the code to remove those devices upon
function completion.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bootstrap/devfs.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/bootstrap/devfs.c b/lib/bootstrap/devfs.c index 48b74f9fe2..b6edec7e2d 100644 --- a/lib/bootstrap/devfs.c +++ b/lib/bootstrap/devfs.c @@ -99,7 +99,7 @@ void* bootstrap_read_devfs(char *devname, bool use_bb, int offset, bootstrap_err( "%s: failed to add bad block aware partition (%d)\n", devname, ret); - goto exit; + goto delete_devfs_partition; } partname = "bbx"; @@ -138,6 +138,14 @@ free_memory: free(header); if (!result) free(to); -exit: + + if (use_bb) { + dev_remove_bb_dev(partname); + partname = "x"; + } + +delete_devfs_partition: + devfs_del_partition(partname); + return result; } |