]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
lookip: fix error handling when creating the socket fails
authorMartin Willi <martin@revosec.ch>
Mon, 8 Jul 2013 08:40:25 +0000 (10:40 +0200)
committerMartin Willi <martin@revosec.ch>
Thu, 18 Jul 2013 14:00:30 +0000 (16:00 +0200)
src/libcharon/plugins/lookip/lookip_plugin.c

index 4466ad99fd22f6c955f754bf0fc8bc42ecf7b007..63b1381627011a2bcf362ae022f3f9218065c08c 100644 (file)
@@ -80,7 +80,7 @@ METHOD(plugin_t, get_features, int,
 METHOD(plugin_t, destroy, void,
        private_lookip_plugin_t *this)
 {
-       this->socket->destroy(this->socket);
+       DESTROY_IF(this->socket);
        this->listener->destroy(this->listener);
        free(this);
 }
@@ -108,7 +108,13 @@ plugin_t *lookip_plugin_create()
                },
                .listener = lookip_listener_create(),
        );
+
        this->socket = lookip_socket_create(this->listener);
+       if (!this->socket)
+       {
+               destroy(this);
+               return NULL;
+       }
 
        return &this->public.plugin;
 }