mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cleanup: drop extra compare
dm_free() already validates for NULL itself.
This commit is contained in:
parent
55f9e2f399
commit
f7e62bc55c
@ -884,15 +884,12 @@ static int remove_metadata(lvmetad_state *s, const char *vgid, int update_pvids)
|
|||||||
|
|
||||||
/* free the unmapped data */
|
/* free the unmapped data */
|
||||||
|
|
||||||
if (info_lookup)
|
|
||||||
dm_free(info_lookup);
|
|
||||||
if (meta_lookup)
|
if (meta_lookup)
|
||||||
dm_config_destroy(meta_lookup);
|
dm_config_destroy(meta_lookup);
|
||||||
if (name_lookup)
|
|
||||||
dm_free(name_lookup);
|
|
||||||
if (outdated_pvs_lookup)
|
if (outdated_pvs_lookup)
|
||||||
dm_config_destroy(outdated_pvs_lookup);
|
dm_config_destroy(outdated_pvs_lookup);
|
||||||
if (vgid_lookup)
|
dm_free(info_lookup);
|
||||||
|
dm_free(name_lookup);
|
||||||
dm_free(vgid_lookup);
|
dm_free(vgid_lookup);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1220,9 +1217,7 @@ static int _update_metadata_add_new(lvmetad_state *s, const char *new_name, cons
|
|||||||
out:
|
out:
|
||||||
out_free:
|
out_free:
|
||||||
if (!new_name_dup || !new_vgid_dup || abort_daemon) {
|
if (!new_name_dup || !new_vgid_dup || abort_daemon) {
|
||||||
if (new_name_dup)
|
|
||||||
dm_free(new_name_dup);
|
dm_free(new_name_dup);
|
||||||
if (new_vgid_dup)
|
|
||||||
dm_free(new_vgid_dup);
|
dm_free(new_vgid_dup);
|
||||||
ERROR(s, "lvmetad could not be updated and is aborting.");
|
ERROR(s, "lvmetad could not be updated and is aborting.");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -1813,7 +1808,6 @@ static response pv_gone(lvmetad_state *s, request r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dm_config_destroy(pvmeta);
|
dm_config_destroy(pvmeta);
|
||||||
if (old_pvid)
|
|
||||||
dm_free(old_pvid);
|
dm_free(old_pvid);
|
||||||
|
|
||||||
return daemon_reply_simple("OK", NULL );
|
return daemon_reply_simple("OK", NULL );
|
||||||
@ -2238,7 +2232,6 @@ static response pv_found(lvmetad_state *s, request r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This was unhashed from device_to_pvid above. */
|
/* This was unhashed from device_to_pvid above. */
|
||||||
if (prev_pvid_on_dev)
|
|
||||||
dm_free((void *)prev_pvid_on_dev);
|
dm_free((void *)prev_pvid_on_dev);
|
||||||
|
|
||||||
return daemon_reply_simple("OK",
|
return daemon_reply_simple("OK",
|
||||||
|
3
lib/cache/lvmcache.c
vendored
3
lib/cache/lvmcache.c
vendored
@ -1898,7 +1898,6 @@ static int _lvmcache_update_vgstatus(struct lvmcache_info *info, uint32_t vgstat
|
|||||||
info->vginfo->creation_host))
|
info->vginfo->creation_host))
|
||||||
goto set_lock_type;
|
goto set_lock_type;
|
||||||
|
|
||||||
if (info->vginfo->creation_host)
|
|
||||||
dm_free(info->vginfo->creation_host);
|
dm_free(info->vginfo->creation_host);
|
||||||
|
|
||||||
if (!(info->vginfo->creation_host = dm_strdup(creation_host))) {
|
if (!(info->vginfo->creation_host = dm_strdup(creation_host))) {
|
||||||
@ -1918,7 +1917,6 @@ set_lock_type:
|
|||||||
if (info->vginfo->lock_type && !strcmp(lock_type, info->vginfo->lock_type))
|
if (info->vginfo->lock_type && !strcmp(lock_type, info->vginfo->lock_type))
|
||||||
goto set_system_id;
|
goto set_system_id;
|
||||||
|
|
||||||
if (info->vginfo->lock_type)
|
|
||||||
dm_free(info->vginfo->lock_type);
|
dm_free(info->vginfo->lock_type);
|
||||||
|
|
||||||
if (!(info->vginfo->lock_type = dm_strdup(lock_type))) {
|
if (!(info->vginfo->lock_type = dm_strdup(lock_type))) {
|
||||||
@ -1937,7 +1935,6 @@ set_system_id:
|
|||||||
if (info->vginfo->system_id && !strcmp(system_id, info->vginfo->system_id))
|
if (info->vginfo->system_id && !strcmp(system_id, info->vginfo->system_id))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (info->vginfo->system_id)
|
|
||||||
dm_free(info->vginfo->system_id);
|
dm_free(info->vginfo->system_id);
|
||||||
|
|
||||||
if (!(info->vginfo->system_id = dm_strdup(system_id))) {
|
if (!(info->vginfo->system_id = dm_strdup(system_id))) {
|
||||||
|
@ -910,8 +910,8 @@ static int _print_historical_lv(struct formatter *f, struct historical_logical_v
|
|||||||
|
|
||||||
r = 1;
|
r = 1;
|
||||||
out:
|
out:
|
||||||
if (descendants_buffer)
|
|
||||||
dm_free(descendants_buffer);
|
dm_free(descendants_buffer);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,6 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
|
|||||||
|
|
||||||
r = 1;
|
r = 1;
|
||||||
out:
|
out:
|
||||||
if (buf)
|
|
||||||
dm_free(buf);
|
dm_free(buf);
|
||||||
if (!dev_close(area->dev))
|
if (!dev_close(area->dev))
|
||||||
stack;
|
stack;
|
||||||
|
@ -547,8 +547,8 @@ static int _report_field_string_list(struct dm_report *rh,
|
|||||||
out:
|
out:
|
||||||
if (!r && sort_value)
|
if (!r && sort_value)
|
||||||
dm_pool_free(rh->mem, sort_value);
|
dm_pool_free(rh->mem, sort_value);
|
||||||
if (arr)
|
|
||||||
dm_free(arr);
|
dm_free(arr);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,10 +330,8 @@ static void _stats_region_destroy(struct dm_stats_region *region)
|
|||||||
region->counters = NULL;
|
region->counters = NULL;
|
||||||
region->bounds = NULL;
|
region->bounds = NULL;
|
||||||
|
|
||||||
if (region->program_id)
|
|
||||||
dm_free(region->program_id);
|
dm_free(region->program_id);
|
||||||
region->program_id = NULL;
|
region->program_id = NULL;
|
||||||
if (region->aux_data)
|
|
||||||
dm_free(region->aux_data);
|
dm_free(region->aux_data);
|
||||||
region->aux_data = NULL;
|
region->aux_data = NULL;
|
||||||
region->region_id = DM_STATS_REGION_NOT_PRESENT;
|
region->region_id = DM_STATS_REGION_NOT_PRESENT;
|
||||||
@ -415,7 +413,6 @@ static void _stats_clear_binding(struct dm_stats *dms)
|
|||||||
dm_pool_free(dms->mem, dms->bind_name);
|
dm_pool_free(dms->mem, dms->bind_name);
|
||||||
if (dms->bind_uuid)
|
if (dms->bind_uuid)
|
||||||
dm_pool_free(dms->mem, dms->bind_uuid);
|
dm_pool_free(dms->mem, dms->bind_uuid);
|
||||||
if (dms->name)
|
|
||||||
dm_free((char *) dms->name);
|
dm_free((char *) dms->name);
|
||||||
|
|
||||||
dms->bind_name = dms->bind_uuid = NULL;
|
dms->bind_name = dms->bind_uuid = NULL;
|
||||||
@ -2996,7 +2993,6 @@ int dm_stats_set_program_id(struct dm_stats *dms, int allow_empty,
|
|||||||
if (!program_id)
|
if (!program_id)
|
||||||
program_id = "";
|
program_id = "";
|
||||||
|
|
||||||
if (dms->program_id)
|
|
||||||
dm_free(dms->program_id);
|
dm_free(dms->program_id);
|
||||||
|
|
||||||
if (!(dms->program_id = dm_strdup(program_id)))
|
if (!(dms->program_id = dm_strdup(program_id)))
|
||||||
|
Loading…
Reference in New Issue
Block a user