mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
hints: no need to check for NULL before free
free() itself checks for NULL.
This commit is contained in:
parent
9af1d63b4d
commit
1760b96368
@ -688,13 +688,11 @@ static int _read_hint_file(struct cmd_context *cmd, struct dm_list *hints, int *
|
|||||||
_filter_to_str(cmd, devices_global_filter_CFG, &filter_str);
|
_filter_to_str(cmd, devices_global_filter_CFG, &filter_str);
|
||||||
if (!filter_str || strcmp(filter_str, _hint_line + keylen)) {
|
if (!filter_str || strcmp(filter_str, _hint_line + keylen)) {
|
||||||
log_debug("ignore hints with different global_filter");
|
log_debug("ignore hints with different global_filter");
|
||||||
if (filter_str)
|
free(filter_str);
|
||||||
free(filter_str);
|
|
||||||
*needs_refresh = 1;
|
*needs_refresh = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (filter_str)
|
free(filter_str);
|
||||||
free(filter_str);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,13 +701,11 @@ static int _read_hint_file(struct cmd_context *cmd, struct dm_list *hints, int *
|
|||||||
_filter_to_str(cmd, devices_filter_CFG, &filter_str);
|
_filter_to_str(cmd, devices_filter_CFG, &filter_str);
|
||||||
if (!filter_str || strcmp(filter_str, _hint_line + keylen)) {
|
if (!filter_str || strcmp(filter_str, _hint_line + keylen)) {
|
||||||
log_debug("ignore hints with different filter");
|
log_debug("ignore hints with different filter");
|
||||||
if (filter_str)
|
free(filter_str);
|
||||||
free(filter_str);
|
|
||||||
*needs_refresh = 1;
|
*needs_refresh = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (filter_str)
|
free(filter_str);
|
||||||
free(filter_str);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -907,13 +903,11 @@ int write_hint_file(struct cmd_context *cmd, int newhints)
|
|||||||
|
|
||||||
_filter_to_str(cmd, devices_global_filter_CFG, &filter_str);
|
_filter_to_str(cmd, devices_global_filter_CFG, &filter_str);
|
||||||
fprintf(fp, "global_filter:%s\n", filter_str ?: "-");
|
fprintf(fp, "global_filter:%s\n", filter_str ?: "-");
|
||||||
if (filter_str)
|
free(filter_str);
|
||||||
free(filter_str);
|
|
||||||
|
|
||||||
_filter_to_str(cmd, devices_filter_CFG, &filter_str);
|
_filter_to_str(cmd, devices_filter_CFG, &filter_str);
|
||||||
fprintf(fp, "filter:%s\n", filter_str ?: "-");
|
fprintf(fp, "filter:%s\n", filter_str ?: "-");
|
||||||
if (filter_str)
|
free(filter_str);
|
||||||
free(filter_str);
|
|
||||||
|
|
||||||
fprintf(fp, "scan_lvs:%d\n", cmd->scan_lvs);
|
fprintf(fp, "scan_lvs:%d\n", cmd->scan_lvs);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user