mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdm: report fix memleak on error path
When _alloc_selection_node() fails, rh should be destroyed. Use 'bad:' label since we have goto_bad with stack embeded.
This commit is contained in:
parent
8eb111dfb8
commit
678cc4e375
@ -2849,24 +2849,24 @@ struct dm_report *dm_report_init_with_selection(uint32_t *report_types,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(root = _alloc_selection_node(rh->mem, SEL_OR)))
|
if (!(root = _alloc_selection_node(rh->mem, SEL_OR)))
|
||||||
return_0;
|
goto_bad;
|
||||||
|
|
||||||
if (!_parse_or_ex(rh, selection, &fin, root))
|
if (!_parse_or_ex(rh, selection, &fin, root))
|
||||||
goto error;
|
goto_bad;
|
||||||
|
|
||||||
next = _skip_space(fin);
|
next = _skip_space(fin);
|
||||||
if (*next) {
|
if (*next) {
|
||||||
log_error("Expecting logical operator");
|
log_error("Expecting logical operator");
|
||||||
log_error(_sel_syntax_error_at_msg, next);
|
log_error(_sel_syntax_error_at_msg, next);
|
||||||
log_error(_sel_help_ref_msg);
|
log_error(_sel_help_ref_msg);
|
||||||
goto error;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
_dm_report_init_update_types(rh, report_types);
|
_dm_report_init_update_types(rh, report_types);
|
||||||
|
|
||||||
rh->selection_root = root;
|
rh->selection_root = root;
|
||||||
return rh;
|
return rh;
|
||||||
error:
|
bad:
|
||||||
dm_report_free(rh);
|
dm_report_free(rh);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user