mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cov: avoid resoure leaks on error path
This commit is contained in:
parent
e8e5e6ee3c
commit
c6efab0111
@ -1955,6 +1955,7 @@ static int _stats_set_aux(struct dm_stats *dms,
|
|||||||
char *group_tag = NULL, *group_tag_escaped = NULL;
|
char *group_tag = NULL, *group_tag_escaped = NULL;
|
||||||
struct dm_task *dmt = NULL;
|
struct dm_task *dmt = NULL;
|
||||||
char msg[STATS_MSG_BUF_LEN];
|
char msg[STATS_MSG_BUF_LEN];
|
||||||
|
int r = 0;
|
||||||
|
|
||||||
/* group data required? */
|
/* group data required? */
|
||||||
if (_stats_group_id_present(dms, region_id)) {
|
if (_stats_group_id_present(dms, region_id)) {
|
||||||
@ -1980,16 +1981,15 @@ static int _stats_set_aux(struct dm_stats *dms,
|
|||||||
if (!(dmt = _stats_send_message(dms, msg)))
|
if (!(dmt = _stats_send_message(dms, msg)))
|
||||||
goto_bad;
|
goto_bad;
|
||||||
|
|
||||||
dm_free(group_tag);
|
|
||||||
dm_free(group_tag_escaped);
|
|
||||||
|
|
||||||
/* no response to a @stats_set_aux message */
|
/* no response to a @stats_set_aux message */
|
||||||
dm_task_destroy(dmt);
|
dm_task_destroy(dmt);
|
||||||
|
|
||||||
return 1;
|
r = 1;
|
||||||
bad:
|
bad:
|
||||||
dm_free((char *) group_tag);
|
dm_free(group_tag_escaped);
|
||||||
return 0;
|
dm_free(group_tag);
|
||||||
|
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2058,8 +2058,7 @@ static int _stats_create_region(struct dm_stats *dms, uint64_t *region_id,
|
|||||||
(uint64_t)llabs(step),
|
(uint64_t)llabs(step),
|
||||||
opt_args, program_id, aux_data) < 0) {
|
opt_args, program_id, aux_data) < 0) {
|
||||||
log_error(err_fmt, "message");
|
log_error(err_fmt, "message");
|
||||||
dm_free((void *) opt_args);
|
goto out;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dmt = _stats_send_message(dms, msg)))
|
if (!(dmt = _stats_send_message(dms, msg)))
|
||||||
|
Loading…
Reference in New Issue
Block a user