mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
hints: free hint list in error exit path
This commit is contained in:
parent
c392ccaa47
commit
f50e7ce76c
@ -356,6 +356,16 @@ void hints_exit(struct cmd_context *cmd)
|
|||||||
return _unlock_hints(cmd);
|
return _unlock_hints(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void free_hints(struct dm_list *hints)
|
||||||
|
{
|
||||||
|
struct hint *hint, *hint2;
|
||||||
|
|
||||||
|
dm_list_iterate_items_safe(hint, hint2, hints) {
|
||||||
|
dm_list_del(&hint->list);
|
||||||
|
free(hint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static struct hint *_find_hint_name(struct dm_list *hints, const char *name)
|
static struct hint *_find_hint_name(struct dm_list *hints, const char *name)
|
||||||
{
|
{
|
||||||
struct hint *hint;
|
struct hint *hint;
|
||||||
@ -787,8 +797,10 @@ static int _read_hint_file(struct cmd_context *cmd, struct dm_list *hints, int *
|
|||||||
if (fclose(fp))
|
if (fclose(fp))
|
||||||
stack;
|
stack;
|
||||||
|
|
||||||
if (!ret)
|
if (!ret) {
|
||||||
|
free_hints(hints);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -24,6 +24,8 @@ struct hint {
|
|||||||
unsigned chosen:1; /* this hint's dev was chosen for scanning */
|
unsigned chosen:1; /* this hint's dev was chosen for scanning */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void free_hints(struct dm_list *hints);
|
||||||
|
|
||||||
int write_hint_file(struct cmd_context *cmd, int newhints);
|
int write_hint_file(struct cmd_context *cmd, int newhints);
|
||||||
|
|
||||||
void clear_hint_file(struct cmd_context *cmd);
|
void clear_hint_file(struct cmd_context *cmd);
|
||||||
|
@ -857,16 +857,6 @@ static int _setup_bcache(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _free_hints(struct dm_list *hints)
|
|
||||||
{
|
|
||||||
struct hint *hint, *hint2;
|
|
||||||
|
|
||||||
dm_list_iterate_items_safe(hint, hint2, hints) {
|
|
||||||
dm_list_del(&hint->list);
|
|
||||||
free(hint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't know how many of num_devs will be PVs that we need to
|
* We don't know how many of num_devs will be PVs that we need to
|
||||||
* keep open, but if it's greater than the soft limit, then we'll
|
* keep open, but if it's greater than the soft limit, then we'll
|
||||||
@ -1165,7 +1155,7 @@ int label_scan(struct cmd_context *cmd)
|
|||||||
if (!validate_hints(cmd, &hints_list)) {
|
if (!validate_hints(cmd, &hints_list)) {
|
||||||
log_debug("Will scan %d remaining devices", dm_list_size(&all_devs));
|
log_debug("Will scan %d remaining devices", dm_list_size(&all_devs));
|
||||||
_scan_list(cmd, cmd->filter, &all_devs, NULL);
|
_scan_list(cmd, cmd->filter, &all_devs, NULL);
|
||||||
_free_hints(&hints_list);
|
free_hints(&hints_list);
|
||||||
using_hints = 0;
|
using_hints = 0;
|
||||||
create_hints = 0;
|
create_hints = 0;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user