Skip to content

Commit

Permalink
toolcontext: reuse destroy_config_context
Browse files Browse the repository at this point in the history
Call existing destroy_config_context() to destroy
some parts of cmd_context.
  • Loading branch information
Zdenek Kabelac committed Dec 20, 2021
1 parent 09a4b56 commit 26e6580
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions lib/commands/toolcontext.c
Original file line number Diff line number Diff line change
Expand Up @@ -2041,25 +2041,17 @@ void destroy_toolcontext(struct cmd_context *cmd)
_destroy_segtypes(&cmd->segtypes);
_destroy_formats(cmd, &cmd->formats);
_destroy_filters(cmd);
if (cmd->mem)
dm_pool_destroy(cmd->mem);
devices_file_exit(cmd);
dev_cache_exit();
_destroy_dev_types(cmd);
_destroy_tags(cmd);

if ((cft_cmdline = remove_config_tree_by_source(cmd, CONFIG_STRING)))
config_destroy(cft_cmdline);
_destroy_config(cmd);

if (cmd->cft_def_hash)
dm_hash_destroy(cmd->cft_def_hash);

if (cmd->libmem)
dm_pool_destroy(cmd->libmem);

if (cmd->pending_delete_mem)
dm_pool_destroy(cmd->pending_delete_mem);
#ifndef VALGRIND_POOL
if (cmd->linebuffer) {
/* Reset stream buffering to defaults */
Expand All @@ -2084,7 +2076,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
free(cmd->linebuffer);
}
#endif
free(cmd);
destroy_config_context(cmd);

lvmpolld_disconnect();

Expand Down

0 comments on commit 26e6580

Please sign in to comment.