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-Tag: 5.1.0rc1~10^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3278c1f7393ce8d60b8069f08cafd03efd93b21;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 4466ad99fd..63b1381627 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; }