From: Tobias Brunner Date: Mon, 1 Apr 2013 11:44:04 +0000 (+0200) Subject: Properly handle situation if no resolver plugins are loaded X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=53ac177cdec046b019d379208b42bcfc9490fbf6;p=people%2Fms%2Fstrongswan.git Properly handle situation if no resolver plugins are loaded --- diff --git a/src/libcharon/plugins/ipseckey/ipseckey_plugin.c b/src/libcharon/plugins/ipseckey/ipseckey_plugin.c index 6f0f10507..7de842dc3 100644 --- a/src/libcharon/plugins/ipseckey/ipseckey_plugin.c +++ b/src/libcharon/plugins/ipseckey/ipseckey_plugin.c @@ -60,7 +60,7 @@ METHOD(plugin_t, destroy, void, { lib->credmgr->remove_set(lib->credmgr, &this->cred->set); } - this->res->destroy(this->res); + DESTROY_IF(this->res); DESTROY_IF(this->cred); free(this); } @@ -87,8 +87,7 @@ plugin_t *ipseckey_plugin_create() if (!this->res) { - DBG1(DBG_CFG, "ipseckey_plugin: Failed to create" - "a DNS resolver instance"); + DBG1(DBG_CFG, "failed to create a DNS resolver instance"); destroy(this); return NULL; } diff --git a/src/libstrongswan/resolver/resolver_manager.c b/src/libstrongswan/resolver/resolver_manager.c index 8effe469a..55531e157 100644 --- a/src/libstrongswan/resolver/resolver_manager.c +++ b/src/libstrongswan/resolver/resolver_manager.c @@ -56,7 +56,11 @@ METHOD(resolver_manager_t, remove_resolver, void, METHOD(resolver_manager_t, create, resolver_t*, private_resolver_manager_t *this) { - return this->constructor(); + if (this->constructor) + { + return this->constructor(); + } + return NULL; } METHOD(resolver_manager_t, destroy, void,