mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-09 01:18:39 +03:00
Fix error path for create_toolcontext
Never return unfinished toolcontext - since error path is hit on various stages of initialization we cannot leave it partially uninitialized, since we would need to spread many more test across the code for config_valid. Instead return NULL and properly release udev library resources as well.
This commit is contained in:
parent
c1ce99cd81
commit
8a9c1b37ad
@ -1,5 +1,6 @@
|
||||
Version 2.02.96 -
|
||||
================================
|
||||
Fix error path for failing toolcontext creation.
|
||||
Fix warn msg for thin pool chunk size and update man for chunksize (2.02.89).
|
||||
|
||||
Version 2.02.95 - 6th March 2012
|
||||
|
@ -1371,6 +1371,11 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
|
||||
|
||||
cmd->config_valid = 1;
|
||||
out:
|
||||
if (cmd->config_valid != 1) {
|
||||
destroy_toolcontext(cmd);
|
||||
cmd = NULL;
|
||||
}
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
@ -1248,13 +1248,16 @@ struct cmd_context *init_lvm(void)
|
||||
if (!udev_init_library_context())
|
||||
stack;
|
||||
|
||||
if (!(cmd = create_toolcontext(0, NULL, 1, 0)))
|
||||
if (!(cmd = create_toolcontext(0, NULL, 1, 0))) {
|
||||
udev_fin_library_context();
|
||||
return_NULL;
|
||||
}
|
||||
|
||||
_cmdline.arg_props = &_arg_props[0];
|
||||
|
||||
if (stored_errno()) {
|
||||
destroy_toolcontext(cmd);
|
||||
udev_fin_library_context();
|
||||
return_NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user