Author: gschneider
Date: Sat Jan 2 21:26:36 2010
New Revision: 44898
URL:
http://svn.reactos.org/svn/reactos?rev=44898&view=rev
Log:
[MSAFD] Only free if memory was allocated, fixes build
Modified:
trunk/reactos/dll/win32/msafd/misc/sndrcv.c
Modified: trunk/reactos/dll/win32/msafd/misc/sndrcv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/sndrc…
==============================================================================
--- trunk/reactos/dll/win32/msafd/misc/sndrcv.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msafd/misc/sndrcv.c [iso-8859-1] Sat Jan 2 21:26:36 2010
@@ -516,7 +516,7 @@
PVOID APCFunction;
HANDLE Event = NULL;
PTRANSPORT_ADDRESS RemoteAddress;
- PSOCKADDR BindAddress;
+ PSOCKADDR BindAddress = NULL;
INT BindAddressLength;
HANDLE SockEvent;
PSOCKET_INFORMATION Socket;
@@ -546,7 +546,10 @@
RemoteAddress = HeapAlloc(GlobalHeap, 0, 0x6 + SocketAddressLength);
if (!RemoteAddress)
{
- HeapFree(GlobalHeap, 0, BindAddress);
+ if (BindAddress != NULL)
+ {
+ HeapFree(GlobalHeap, 0, BindAddress);
+ }
return MsafdReturnWithErrno(STATUS_INSUFFICIENT_RESOURCES, lpErrno, 0, NULL);
}
@@ -557,7 +560,10 @@
if (!NT_SUCCESS(Status))
{
HeapFree(GlobalHeap, 0, RemoteAddress);
- HeapFree(GlobalHeap, 0, BindAddress);
+ if (BindAddress != NULL)
+ {
+ HeapFree(GlobalHeap, 0, BindAddress);
+ }
return SOCKET_ERROR;
}
@@ -626,7 +632,10 @@
NtClose(SockEvent);
HeapFree(GlobalHeap, 0, RemoteAddress);
- HeapFree(GlobalHeap, 0, BindAddress);
+ if (BindAddress != NULL)
+ {
+ HeapFree(GlobalHeap, 0, BindAddress);
+ }
if (Status == STATUS_PENDING)
return WSA_IO_PENDING;