core/transport: Fix leak found by covscan
authorOndrej Holy <oholy@redhat.com>
Mon, 20 Aug 2018 09:26:35 +0000 (11:26 +0200)
committerOndrej Holy <oholy@redhat.com>
Wed, 22 Aug 2018 12:34:02 +0000 (14:34 +0200)
0 is valid return value from socket().

leaked_handle: Handle variable "sockfd" going out of scope leaks the handle.

libfreerdp/core/transport.c

index 8c1ef1f..01e8682 100644 (file)
@@ -419,7 +419,7 @@ BOOL transport_connect(rdpTransport* transport, const char* hostname,
                else
                        sockfd = freerdp_tcp_connect(context, settings, hostname, port, timeout);
 
-               if (sockfd < 1)
+               if (sockfd < 0)
                        return FALSE;
 
                if (!transport_attach(transport, sockfd))