From: Dave Wysochanski Date: Wed, 8 Jul 2009 18:12:08 +0000 (+0000) Subject: Make destroy_toolcontext() better able to handle NULL pointers. X-Git-Tag: v2_02_91~2994 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=71e41d91399a908d1daa7a2740852656276b9211;p=lvm2.git Make destroy_toolcontext() better able to handle NULL pointers. Part of twoerner's log_error() patches. Signed-off-by: Thomas Woerner Signed-off-by: Dave Wysochanski --- diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c index 2ffea19af..820bf9a8d 100644 --- a/lib/commands/toolcontext.c +++ b/lib/commands/toolcontext.c @@ -1302,12 +1302,15 @@ void destroy_toolcontext(struct cmd_context *cmd) label_exit(); _destroy_segtypes(&cmd->segtypes); _destroy_formats(&cmd->formats); - cmd->filter->destroy(cmd->filter); - dm_pool_destroy(cmd->mem); + if (cmd->filter) + cmd->filter->destroy(cmd->filter); + if (cmd->mem) + dm_pool_destroy(cmd->mem); dev_cache_exit(); _destroy_tags(cmd); _destroy_tag_configs(cmd); - dm_pool_destroy(cmd->libmem); + if (cmd->libmem) + dm_pool_destroy(cmd->libmem); dm_free(cmd); release_log_memory();