Properly handle situation if no resolver plugins are loaded

This commit is contained in:
Tobias Brunner
2013-04-01 13:44:04 +02:00
parent 5a516a83da
commit 53ac177cde
2 changed files with 7 additions and 4 deletions
@@ -60,7 +60,7 @@ METHOD(plugin_t, destroy, void,
{ {
lib->credmgr->remove_set(lib->credmgr, &this->cred->set); lib->credmgr->remove_set(lib->credmgr, &this->cred->set);
} }
this->res->destroy(this->res); DESTROY_IF(this->res);
DESTROY_IF(this->cred); DESTROY_IF(this->cred);
free(this); free(this);
} }
@@ -87,8 +87,7 @@ plugin_t *ipseckey_plugin_create()
if (!this->res) if (!this->res)
{ {
DBG1(DBG_CFG, "ipseckey_plugin: Failed to create" DBG1(DBG_CFG, "failed to create a DNS resolver instance");
"a DNS resolver instance");
destroy(this); destroy(this);
return NULL; return NULL;
} }
@@ -56,7 +56,11 @@ METHOD(resolver_manager_t, remove_resolver, void,
METHOD(resolver_manager_t, create, resolver_t*, METHOD(resolver_manager_t, create, resolver_t*,
private_resolver_manager_t *this) private_resolver_manager_t *this)
{ {
return this->constructor(); if (this->constructor)
{
return this->constructor();
}
return NULL;
} }
METHOD(resolver_manager_t, destroy, void, METHOD(resolver_manager_t, destroy, void,