]> git.ipfire.org Git - people/ms/strongswan.git/commitdiff
Properly handle situation if no resolver plugins are loaded
authorTobias Brunner <tobias@strongswan.org>
Mon, 1 Apr 2013 11:44:04 +0000 (13:44 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 1 Apr 2013 11:44:04 +0000 (13:44 +0200)
src/libcharon/plugins/ipseckey/ipseckey_plugin.c
src/libstrongswan/resolver/resolver_manager.c

index 6f0f10507b5261f3eef2e419ebbc3060c7145705..7de842dc307a83bf0040d812250c93ff94ce0206 100644 (file)
@@ -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;
        }
index 8effe469ad68baea9ebd5e57976d5743232b0ec0..55531e157962f739fd8e53cd94bf8e8329c0a350 100644 (file)
@@ -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,