From 7e866d72cda3f5cd3b1332492224f07c4cf9c817 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Fri, 4 Sep 2015 07:48:18 +0000 Subject: [PATCH] [NSLOOKUP] fix resource leaks CID 701325 svn path=/trunk/; revision=68977 --- reactos/base/applications/network/nslookup/utility.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/reactos/base/applications/network/nslookup/utility.c b/reactos/base/applications/network/nslookup/utility.c index 3b8d17f92b1..029e8bbabf5 100644 --- a/reactos/base/applications/network/nslookup/utility.c +++ b/reactos/base/applications/network/nslookup/utility.c @@ -33,6 +33,9 @@ BOOL SendRequest( PCHAR pInBuffer, /* Create the sockets for both send and receive. */ s = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); + if (s == INVALID_SOCKET) + return FALSE; + /* Set up the structure to tell it where we are going. */ RecAddr.sin_family = AF_INET; RecAddr.sin_port = htons( State.port ); @@ -130,6 +133,7 @@ BOOL SendRequest( PCHAR pInBuffer, _tprintf( _T("sendto() failed with unknown error\n") ); } + closesocket( s ); return FALSE; } @@ -221,6 +225,7 @@ BOOL SendRequest( PCHAR pInBuffer, _tprintf( _T("recvfrom() failed with unknown error\n") ); } + closesocket( s ); return FALSE; }