]> 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>
Wed, 17 Jul 2013 14:55:51 +0000 (16:55 +0200)
src/libcharon/plugins/lookip/lookip_plugin.c

index 89bdad92e492f52541b36c884d1ab41d327d284f..a9474fc163ba3ad35d8540ecef68095eba94b112 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;
 }