mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
hints: free hint structs on exit
and free on a couple error paths.
This commit is contained in:
parent
2f29765e7f
commit
5c095400de
@ -1598,6 +1598,7 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
|
|||||||
dm_list_init(&cmd->formats);
|
dm_list_init(&cmd->formats);
|
||||||
dm_list_init(&cmd->segtypes);
|
dm_list_init(&cmd->segtypes);
|
||||||
dm_list_init(&cmd->tags);
|
dm_list_init(&cmd->tags);
|
||||||
|
dm_list_init(&cmd->hints);
|
||||||
dm_list_init(&cmd->config_files);
|
dm_list_init(&cmd->config_files);
|
||||||
label_init();
|
label_init();
|
||||||
|
|
||||||
|
@ -351,6 +351,7 @@ static void _unlock_hints(struct cmd_context *cmd)
|
|||||||
|
|
||||||
void hints_exit(struct cmd_context *cmd)
|
void hints_exit(struct cmd_context *cmd)
|
||||||
{
|
{
|
||||||
|
free_hints(&cmd->hints);
|
||||||
if (_hints_fd == -1)
|
if (_hints_fd == -1)
|
||||||
return;
|
return;
|
||||||
return _unlock_hints(cmd);
|
return _unlock_hints(cmd);
|
||||||
@ -1321,6 +1322,7 @@ int get_hints(struct cmd_context *cmd, struct dm_list *hints_out, int *newhints,
|
|||||||
*/
|
*/
|
||||||
if (!_read_hint_file(cmd, &hints_list, &needs_refresh)) {
|
if (!_read_hint_file(cmd, &hints_list, &needs_refresh)) {
|
||||||
log_debug("get_hints: read fail");
|
log_debug("get_hints: read fail");
|
||||||
|
free_hints(&hints_list);
|
||||||
_unlock_hints(cmd);
|
_unlock_hints(cmd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1333,6 +1335,7 @@ int get_hints(struct cmd_context *cmd, struct dm_list *hints_out, int *newhints,
|
|||||||
*/
|
*/
|
||||||
if (needs_refresh) {
|
if (needs_refresh) {
|
||||||
log_debug("get_hints: needs refresh");
|
log_debug("get_hints: needs refresh");
|
||||||
|
free_hints(&hints_list);
|
||||||
|
|
||||||
if (!_lock_hints(cmd, LOCK_EX, NONBLOCK))
|
if (!_lock_hints(cmd, LOCK_EX, NONBLOCK))
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user