From: Martin Willi Date: Mon, 8 Jul 2013 08:40:25 +0000 (+0200) Subject: lookip: fix error handling when creating the socket fails X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=057a1d0599706e74e74448aa029b2250edc0ce90;p=thirdparty%2Fstrongswan.git lookip: fix error handling when creating the socket fails --- diff --git a/src/libcharon/plugins/lookip/lookip_plugin.c b/src/libcharon/plugins/lookip/lookip_plugin.c index 89bdad92e4..a9474fc163 100644 --- a/src/libcharon/plugins/lookip/lookip_plugin.c +++ b/src/libcharon/plugins/lookip/lookip_plugin.c @@ -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; }