Destroy Netlink socket only after deleting remaining source routes.
authorTobias Brunner <tobias@strongswan.org>
Mon, 21 May 2012 11:19:57 +0000 (13:19 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 21 May 2012 11:33:13 +0000 (13:33 +0200)
src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c

index 8a5eaa0..c64a66b 100644 (file)
@@ -1762,8 +1762,6 @@ METHOD(kernel_net_t, destroy, void,
        {
                close(this->socket_events);
        }
-       DESTROY_IF(this->socket);
-
        enumerator = this->routes->create_enumerator(this->routes);
        while (enumerator->enumerate(enumerator, NULL, (void**)&route))
        {
@@ -1773,6 +1771,7 @@ METHOD(kernel_net_t, destroy, void,
        }
        enumerator->destroy(enumerator);
        this->routes->destroy(this->routes);
+       DESTROY_IF(this->socket);
 
        net_changes_clear(this);
        this->net_changes->destroy(this->net_changes);