mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cmdlib_lvm2_init: release cmd on failure path
The cmd memory space is allocated by zalloc, and the registration fails and is not released. Although this code would be ever triggered just in the case of some internal (likely compilation) bug. Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
This commit is contained in:
parent
cd897e536f
commit
b36ab8a063
@ -33,8 +33,10 @@ void *cmdlib_lvm2_init(unsigned static_compile, unsigned threaded)
|
||||
if (!(cmd = init_lvm(1, 1, threaded)))
|
||||
return NULL;
|
||||
|
||||
if (!lvm_register_commands(cmd, NULL))
|
||||
if (!lvm_register_commands(cmd, NULL)) {
|
||||
free(cmd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (void *) cmd;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user