windows: Close correct socket when opening second socket fails in socketpair()
authorTobias Brunner <tobias@strongswan.org>
Wed, 2 Jul 2014 09:51:37 +0000 (11:51 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 2 Jul 2014 10:38:44 +0000 (12:38 +0200)
src/libstrongswan/utils/windows.c

index 2168d64..a4b9834 100644 (file)
@@ -221,7 +221,7 @@ int socketpair(int domain, int type, int protocol, int sv[2])
        c = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
        if (c == -1)
        {
-               closesocket(c);
+               closesocket(s);
                return -1;
        }
        if (bind(s, (struct sockaddr*)&addr, sizeof(addr)) == 0 &&