Commit 76205649 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

dplayx: Use CRT allocation functions.

parent a3209dae
...@@ -96,9 +96,9 @@ static ULONG WINAPI IDirectPlaySPImpl_Release( IDirectPlaySP *iface ) ...@@ -96,9 +96,9 @@ static ULONG WINAPI IDirectPlaySPImpl_Release( IDirectPlaySP *iface )
if( !ref ) if( !ref )
{ {
HeapFree( GetProcessHeap(), 0, This->remote_data ); free( This->remote_data );
HeapFree( GetProcessHeap(), 0, This->local_data ); free( This->local_data );
HeapFree( GetProcessHeap(), 0, This ); free( This );
} }
return ref; return ref;
...@@ -531,7 +531,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_SetSPPlayerData( IDirectPlaySP *iface, D ...@@ -531,7 +531,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_SetSPPlayerData( IDirectPlaySP *iface, D
return DPERR_INVALIDPLAYER; return DPERR_INVALIDPLAYER;
} }
lpPlayerData = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwDataSize ); lpPlayerData = malloc( dwDataSize );
CopyMemory( lpPlayerData, lpData, dwDataSize ); CopyMemory( lpPlayerData, lpData, dwDataSize );
if( dwFlags == DPSET_LOCAL ) if( dwFlags == DPSET_LOCAL )
...@@ -635,19 +635,19 @@ static HRESULT WINAPI IDirectPlaySPImpl_SetSPData( IDirectPlaySP *iface, void *l ...@@ -635,19 +635,19 @@ static HRESULT WINAPI IDirectPlaySPImpl_SetSPData( IDirectPlaySP *iface, void *l
} }
#endif #endif
lpSpData = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwDataSize ); lpSpData = malloc( dwDataSize );
CopyMemory( lpSpData, lpData, dwDataSize ); CopyMemory( lpSpData, lpData, dwDataSize );
/* If we have data already allocated, free it and replace it */ /* If we have data already allocated, free it and replace it */
if( dwFlags == DPSET_REMOTE ) if( dwFlags == DPSET_REMOTE )
{ {
HeapFree( GetProcessHeap(), 0, This->remote_data ); free( This->remote_data );
This->remote_data_size = dwDataSize; This->remote_data_size = dwDataSize;
This->remote_data = lpSpData; This->remote_data = lpSpData;
} }
else if ( dwFlags == DPSET_LOCAL ) else if ( dwFlags == DPSET_LOCAL )
{ {
HeapFree( GetProcessHeap(), 0, This->local_data ); free( This->local_data );
This->local_data = lpSpData; This->local_data = lpSpData;
This->local_data_size = dwDataSize; This->local_data_size = dwDataSize;
} }
...@@ -691,7 +691,7 @@ HRESULT dplaysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp ) ...@@ -691,7 +691,7 @@ HRESULT dplaysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp )
TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv ); TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv );
*ppv = NULL; *ppv = NULL;
obj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *obj ) ); obj = calloc( 1, sizeof( *obj ) );
if ( !obj ) if ( !obj )
return DPERR_OUTOFMEMORY; return DPERR_OUTOFMEMORY;
...@@ -711,6 +711,5 @@ HRESULT dplaysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp ) ...@@ -711,6 +711,5 @@ HRESULT dplaysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp )
LPVOID DPSP_CreateSPPlayerData(void) LPVOID DPSP_CreateSPPlayerData(void)
{ {
TRACE( "Creating SPPlayer data struct\n" ); TRACE( "Creating SPPlayer data struct\n" );
return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, return calloc( 1, sizeof( DP_SPPLAYERDATA ) );
sizeof( DP_SPPLAYERDATA ) );
} }
...@@ -59,7 +59,7 @@ DWORD CreateLobbyMessageReceptionThread( HANDLE hNotifyEvent, HANDLE hStart, ...@@ -59,7 +59,7 @@ DWORD CreateLobbyMessageReceptionThread( HANDLE hNotifyEvent, HANDLE hStart,
LPMSGTHREADINFO lpThreadInfo; LPMSGTHREADINFO lpThreadInfo;
HANDLE hThread; HANDLE hThread;
lpThreadInfo = HeapAlloc( GetProcessHeap(), 0, sizeof( *lpThreadInfo ) ); lpThreadInfo = malloc( sizeof( *lpThreadInfo ) );
if( lpThreadInfo == NULL ) if( lpThreadInfo == NULL )
{ {
return 0; return 0;
...@@ -102,7 +102,7 @@ DWORD CreateLobbyMessageReceptionThread( HANDLE hNotifyEvent, HANDLE hStart, ...@@ -102,7 +102,7 @@ DWORD CreateLobbyMessageReceptionThread( HANDLE hNotifyEvent, HANDLE hStart,
error: error:
HeapFree( GetProcessHeap(), 0, lpThreadInfo ); free( lpThreadInfo );
return 0; return 0;
} }
...@@ -147,7 +147,7 @@ static DWORD CALLBACK DPL_MSG_ThreadMain( LPVOID lpContext ) ...@@ -147,7 +147,7 @@ static DWORD CALLBACK DPL_MSG_ThreadMain( LPVOID lpContext )
end_of_thread: end_of_thread:
TRACE( "Msg thread exiting!\n" ); TRACE( "Msg thread exiting!\n" );
HeapFree( GetProcessHeap(), 0, lpThreadInfo ); free( lpThreadInfo );
return 0; return 0;
} }
...@@ -190,7 +190,7 @@ HRESULT DP_MSG_SendRequestPlayerId( IDirectPlayImpl *This, DWORD dwFlags, DPID * ...@@ -190,7 +190,7 @@ HRESULT DP_MSG_SendRequestPlayerId( IDirectPlayImpl *This, DWORD dwFlags, DPID *
dwMsgSize = This->dp2->spData.dwSPHeaderSize + sizeof( *lpMsgBody ); dwMsgSize = This->dp2->spData.dwSPHeaderSize + sizeof( *lpMsgBody );
lpMsg = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwMsgSize ); lpMsg = calloc( 1, dwMsgSize );
lpMsgBody = (LPDPMSG_REQUESTNEWPLAYERID)( (BYTE*)lpMsg + lpMsgBody = (LPDPMSG_REQUESTNEWPLAYERID)( (BYTE*)lpMsg +
This->dp2->spData.dwSPHeaderSize ); This->dp2->spData.dwSPHeaderSize );
...@@ -241,7 +241,7 @@ HRESULT DP_MSG_SendRequestPlayerId( IDirectPlayImpl *This, DWORD dwFlags, DPID * ...@@ -241,7 +241,7 @@ HRESULT DP_MSG_SendRequestPlayerId( IDirectPlayImpl *This, DWORD dwFlags, DPID *
* for several different messages? * for several different messages?
*/ */
HeapFree( GetProcessHeap(), 0, lpMsg ); free( lpMsg );
} }
return hr; return hr;
...@@ -256,7 +256,7 @@ HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlayImpl *This, DPID dpidServer ) ...@@ -256,7 +256,7 @@ HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlayImpl *This, DPID dpidServer )
dwMsgSize = This->dp2->spData.dwSPHeaderSize + sizeof( *lpMsgBody ); dwMsgSize = This->dp2->spData.dwSPHeaderSize + sizeof( *lpMsgBody );
lpMsg = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwMsgSize ); lpMsg = calloc( 1, dwMsgSize );
lpMsgBody = (LPDPMSG_FORWARDADDPLAYER)( (BYTE*)lpMsg + lpMsgBody = (LPDPMSG_FORWARDADDPLAYER)( (BYTE*)lpMsg +
This->dp2->spData.dwSPHeaderSize ); This->dp2->spData.dwSPHeaderSize );
...@@ -428,9 +428,7 @@ void DP_MSG_ReplyReceived( IDirectPlayImpl *This, WORD wCommandId, const void *l ...@@ -428,9 +428,7 @@ void DP_MSG_ReplyReceived( IDirectPlayImpl *This, WORD wCommandId, const void *l
if( lpReplyList != NULL ) if( lpReplyList != NULL )
{ {
lpReplyList->replyExpected.dwMsgBodySize = dwMsgBodySize; lpReplyList->replyExpected.dwMsgBodySize = dwMsgBodySize;
lpReplyList->replyExpected.lpReplyMsg = HeapAlloc( GetProcessHeap(), lpReplyList->replyExpected.lpReplyMsg = malloc( dwMsgBodySize );
HEAP_ZERO_MEMORY,
dwMsgBodySize );
CopyMemory( lpReplyList->replyExpected.lpReplyMsg, CopyMemory( lpReplyList->replyExpected.lpReplyMsg,
lpcMsgBody, dwMsgBodySize ); lpcMsgBody, dwMsgBodySize );
...@@ -452,7 +450,7 @@ void DP_MSG_ToSelf( IDirectPlayImpl *This, DPID dpidSelf ) ...@@ -452,7 +450,7 @@ void DP_MSG_ToSelf( IDirectPlayImpl *This, DPID dpidSelf )
dwMsgSize = This->dp2->spData.dwSPHeaderSize + sizeof( *lpMsgBody ); dwMsgSize = This->dp2->spData.dwSPHeaderSize + sizeof( *lpMsgBody );
lpMsg = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwMsgSize ); lpMsg = calloc( 1, dwMsgSize );
lpMsgBody = (LPDPMSG_SENDENVELOPE)( (BYTE*)lpMsg + lpMsgBody = (LPDPMSG_SENDENVELOPE)( (BYTE*)lpMsg +
This->dp2->spData.dwSPHeaderSize ); This->dp2->spData.dwSPHeaderSize );
......
...@@ -115,7 +115,7 @@ static void dplobby_destroy(IDirectPlayLobbyImpl *obj) ...@@ -115,7 +115,7 @@ static void dplobby_destroy(IDirectPlayLobbyImpl *obj)
DPQ_DELETEQ( obj->msgs, msgs, LPDPLMSG, cbDeleteElemFromHeap ); DPQ_DELETEQ( obj->msgs, msgs, LPDPLMSG, cbDeleteElemFromHeap );
obj->lock.DebugInfo->Spare[0] = 0; obj->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &obj->lock ); DeleteCriticalSection( &obj->lock );
HeapFree( GetProcessHeap(), 0, obj ); free( obj );
} }
static HRESULT WINAPI IDirectPlayLobbyAImpl_QueryInterface( IDirectPlayLobbyA *iface, REFIID riid, static HRESULT WINAPI IDirectPlayLobbyAImpl_QueryInterface( IDirectPlayLobbyA *iface, REFIID riid,
...@@ -405,7 +405,7 @@ static HRESULT DPL_ConnectEx( IDirectPlayLobbyImpl *This, DWORD dwFlags, REFIID ...@@ -405,7 +405,7 @@ static HRESULT DPL_ConnectEx( IDirectPlayLobbyImpl *This, DWORD dwFlags, REFIID
return hr; return hr;
} }
lpConn = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwConnSize ); lpConn = calloc( 1, dwConnSize );
if( lpConn == NULL ) if( lpConn == NULL )
{ {
...@@ -417,7 +417,7 @@ static HRESULT DPL_ConnectEx( IDirectPlayLobbyImpl *This, DWORD dwFlags, REFIID ...@@ -417,7 +417,7 @@ static HRESULT DPL_ConnectEx( IDirectPlayLobbyImpl *This, DWORD dwFlags, REFIID
0, lpConn, &dwConnSize ); 0, lpConn, &dwConnSize );
if( FAILED( hr ) ) if( FAILED( hr ) )
{ {
HeapFree( GetProcessHeap(), 0, lpConn ); free( lpConn );
return hr; return hr;
} }
...@@ -442,7 +442,7 @@ static HRESULT DPL_ConnectEx( IDirectPlayLobbyImpl *This, DWORD dwFlags, REFIID ...@@ -442,7 +442,7 @@ static HRESULT DPL_ConnectEx( IDirectPlayLobbyImpl *This, DWORD dwFlags, REFIID
hr = IDirectPlayX_Open( (*(LPDIRECTPLAY2*)lplpDP), lpConn->lpSessionDesc, hr = IDirectPlayX_Open( (*(LPDIRECTPLAY2*)lplpDP), lpConn->lpSessionDesc,
dwOpenFlags ); dwOpenFlags );
HeapFree( GetProcessHeap(), 0, lpConn ); free( lpConn );
return hr; return hr;
} }
...@@ -1153,8 +1153,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications ...@@ -1153,8 +1153,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications
} }
else else
{ {
if ((lpData->lpszCommandLine = HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer)+1 ))) lpData->lpszCommandLine = strdup( returnBuffer );
strcpy( lpData->lpszCommandLine, returnBuffer );
} }
sizeOfReturnBuffer = 200; sizeOfReturnBuffer = 200;
...@@ -1167,8 +1166,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications ...@@ -1167,8 +1166,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications
} }
else else
{ {
if ((lpData->lpszCurrentDirectory = HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer)+1 ))) lpData->lpszCurrentDirectory = strdup( returnBuffer );
strcpy( lpData->lpszCurrentDirectory, returnBuffer );
} }
sizeOfReturnBuffer = 200; sizeOfReturnBuffer = 200;
...@@ -1181,8 +1179,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications ...@@ -1181,8 +1179,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications
} }
else else
{ {
if ((lpData->lpszFileName = HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer)+1 ))) lpData->lpszFileName = strdup( returnBuffer );
strcpy( lpData->lpszFileName, returnBuffer );
} }
sizeOfReturnBuffer = 200; sizeOfReturnBuffer = 200;
...@@ -1195,8 +1192,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications ...@@ -1195,8 +1192,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications
} }
else else
{ {
if ((lpData->lpszPath = HeapAlloc( GetProcessHeap(), 0, strlen(returnBuffer)+1 ))) lpData->lpszPath = strdup( returnBuffer );
strcpy( lpData->lpszPath, returnBuffer );
} }
return FALSE; /* No need to keep going as we found what we wanted */ return FALSE; /* No need to keep going as we found what we wanted */
...@@ -1330,16 +1326,15 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_RunApplication( IDirectPlayLobby3A ...@@ -1330,16 +1326,15 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_RunApplication( IDirectPlayLobby3A
strcpy( temp, enumData.lpszPath ); strcpy( temp, enumData.lpszPath );
strcat( temp, "\\" ); strcat( temp, "\\" );
strcat( temp, enumData.lpszFileName ); strcat( temp, enumData.lpszFileName );
HeapFree( GetProcessHeap(), 0, enumData.lpszPath ); free( enumData.lpszPath );
HeapFree( GetProcessHeap(), 0, enumData.lpszFileName ); free( enumData.lpszFileName );
if ((appName = HeapAlloc( GetProcessHeap(), 0, strlen(temp)+1 ))) strcpy( appName, temp ); appName = strdup( temp );
/* Now the command line */ /* Now the command line */
strcat( temp, " " ); strcat( temp, " " );
strcat( temp, enumData.lpszCommandLine ); strcat( temp, enumData.lpszCommandLine );
HeapFree( GetProcessHeap(), 0, enumData.lpszCommandLine ); free( enumData.lpszCommandLine );
if ((enumData.lpszCommandLine = HeapAlloc( GetProcessHeap(), 0, strlen(temp)+1 ))) enumData.lpszCommandLine = strdup( temp );
strcpy( enumData.lpszCommandLine, temp );
ZeroMemory( &startupInfo, sizeof( startupInfo ) ); ZeroMemory( &startupInfo, sizeof( startupInfo ) );
startupInfo.cb = sizeof( startupInfo ); startupInfo.cb = sizeof( startupInfo );
...@@ -1362,17 +1357,17 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_RunApplication( IDirectPlayLobby3A ...@@ -1362,17 +1357,17 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_RunApplication( IDirectPlayLobby3A
{ {
ERR( "Failed to create process for app %s\n", appName ); ERR( "Failed to create process for app %s\n", appName );
HeapFree( GetProcessHeap(), 0, appName ); free( appName );
HeapFree( GetProcessHeap(), 0, enumData.lpszCommandLine ); free( enumData.lpszCommandLine );
HeapFree( GetProcessHeap(), 0, enumData.lpszCurrentDirectory ); free( enumData.lpszCurrentDirectory );
LeaveCriticalSection( &This->lock ); LeaveCriticalSection( &This->lock );
return DPERR_CANTCREATEPROCESS; return DPERR_CANTCREATEPROCESS;
} }
HeapFree( GetProcessHeap(), 0, appName ); free( appName );
HeapFree( GetProcessHeap(), 0, enumData.lpszCommandLine ); free( enumData.lpszCommandLine );
HeapFree( GetProcessHeap(), 0, enumData.lpszCurrentDirectory ); free( enumData.lpszCurrentDirectory );
/* Reserve this global application id! */ /* Reserve this global application id! */
if( !DPLAYX_CreateLobbyApplication( newProcessInfo.dwProcessId ) ) if( !DPLAYX_CreateLobbyApplication( newProcessInfo.dwProcessId ) )
...@@ -2029,7 +2024,7 @@ HRESULT dplobby_create( REFIID riid, void **ppv ) ...@@ -2029,7 +2024,7 @@ HRESULT dplobby_create( REFIID riid, void **ppv )
TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv ); TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv );
*ppv = NULL; *ppv = NULL;
obj = HeapAlloc( GetProcessHeap(), 0, sizeof( *obj ) ); obj = malloc( sizeof( *obj ) );
if ( !obj ) if ( !obj )
return DPERR_OUTOFMEMORY; return DPERR_OUTOFMEMORY;
......
...@@ -73,7 +73,7 @@ static ULONG WINAPI IDPLobbySPImpl_Release( IDPLobbySP *iface ) ...@@ -73,7 +73,7 @@ static ULONG WINAPI IDPLobbySPImpl_Release( IDPLobbySP *iface )
TRACE( "(%p) ref=%ld\n", This, ref ); TRACE( "(%p) ref=%ld\n", This, ref );
if( !ref ) if( !ref )
HeapFree( GetProcessHeap(), 0, This ); free( This );
return ref; return ref;
} }
...@@ -235,7 +235,7 @@ HRESULT dplobbysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp ) ...@@ -235,7 +235,7 @@ HRESULT dplobbysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp )
TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv ); TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv );
*ppv = NULL; *ppv = NULL;
obj = HeapAlloc( GetProcessHeap(), 0, sizeof( *obj ) ); obj = malloc( sizeof( *obj ) );
if ( !obj ) if ( !obj )
return DPERR_OUTOFMEMORY; return DPERR_OUTOFMEMORY;
......
...@@ -105,7 +105,7 @@ void NS_AddRemoteComputerAsNameServer( LPCVOID lpcNSAddrHdr ...@@ -105,7 +105,7 @@ void NS_AddRemoteComputerAsNameServer( LPCVOID lpcNSAddrHdr
} }
/* Add this to the list */ /* Add this to the list */
lpCacheNode = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpCacheNode ) ); lpCacheNode = calloc( 1, sizeof( *lpCacheNode ) );
if( lpCacheNode == NULL ) if( lpCacheNode == NULL )
{ {
...@@ -113,22 +113,21 @@ void NS_AddRemoteComputerAsNameServer( LPCVOID lpcNSAddrHdr ...@@ -113,22 +113,21 @@ void NS_AddRemoteComputerAsNameServer( LPCVOID lpcNSAddrHdr
return; return;
} }
lpCacheNode->lpNSAddrHdr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, lpCacheNode->lpNSAddrHdr = malloc( dwHdrSize );
dwHdrSize );
CopyMemory( lpCacheNode->lpNSAddrHdr, lpcNSAddrHdr, dwHdrSize ); CopyMemory( lpCacheNode->lpNSAddrHdr, lpcNSAddrHdr, dwHdrSize );
lpCacheNode->data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(lpCacheNode->data) ) ); lpCacheNode->data = calloc( 1, sizeof( *(lpCacheNode->data) ) );
if( lpCacheNode->data == NULL ) if( lpCacheNode->data == NULL )
{ {
ERR( "no memory for SESSIONDESC2\n" ); ERR( "no memory for SESSIONDESC2\n" );
HeapFree( GetProcessHeap(), 0, lpCacheNode ); free( lpCacheNode );
return; return;
} }
*lpCacheNode->data = lpcMsg->sd; *lpCacheNode->data = lpcMsg->sd;
len = WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)(lpcMsg+1), -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)(lpcMsg+1), -1, NULL, 0, NULL, NULL );
if ((lpCacheNode->data->lpszSessionNameA = HeapAlloc( GetProcessHeap(), 0, len ))) if ((lpCacheNode->data->lpszSessionNameA = malloc( len )))
{ {
WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)(lpcMsg+1), -1, WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)(lpcMsg+1), -1,
lpCacheNode->data->lpszSessionNameA, len, NULL, NULL ); lpCacheNode->data->lpszSessionNameA, len, NULL, NULL );
...@@ -183,7 +182,7 @@ void NS_SetLocalAddr( LPVOID lpNSInfo, LPCVOID lpHdr, DWORD dwHdrSize ) ...@@ -183,7 +182,7 @@ void NS_SetLocalAddr( LPVOID lpNSInfo, LPCVOID lpHdr, DWORD dwHdrSize )
{ {
lpNSCache lpCache = (lpNSCache)lpNSInfo; lpNSCache lpCache = (lpNSCache)lpNSInfo;
lpCache->lpLocalAddrHdr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwHdrSize ); lpCache->lpLocalAddrHdr = malloc( dwHdrSize );
CopyMemory( lpCache->lpLocalAddrHdr, lpHdr, dwHdrSize ); CopyMemory( lpCache->lpLocalAddrHdr, lpHdr, dwHdrSize );
} }
...@@ -205,8 +204,7 @@ HRESULT NS_SendSessionRequestBroadcast( LPCGUID lpcGuid, ...@@ -205,8 +204,7 @@ HRESULT NS_SendSessionRequestBroadcast( LPCGUID lpcGuid,
FIXME( ": not all data fields are correct\n" ); FIXME( ": not all data fields are correct\n" );
data.dwMessageSize = lpSpData->dwSPHeaderSize + sizeof( *lpMsg ); /*FIXME!*/ data.dwMessageSize = lpSpData->dwSPHeaderSize + sizeof( *lpMsg ); /*FIXME!*/
data.lpMessage = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, data.lpMessage = calloc( 1, data.dwMessageSize );
data.dwMessageSize );
data.lpISP = lpSpData->lpISP; data.lpISP = lpSpData->lpISP;
data.bReturnStatus = (dwFlags & DPENUMSESSIONS_RETURNSTATUS) != 0; data.bReturnStatus = (dwFlags & DPENUMSESSIONS_RETURNSTATUS) != 0;
...@@ -232,9 +230,9 @@ static DPQ_DECL_DELETECB( cbDeleteNSNodeFromHeap, lpNSCacheData ) ...@@ -232,9 +230,9 @@ static DPQ_DECL_DELETECB( cbDeleteNSNodeFromHeap, lpNSCacheData )
/* NOTE: This proc doesn't deal with the walking pointer */ /* NOTE: This proc doesn't deal with the walking pointer */
/* FIXME: Memory leak on data (contained ptrs) */ /* FIXME: Memory leak on data (contained ptrs) */
HeapFree( GetProcessHeap(), 0, elem->data ); free( elem->data );
HeapFree( GetProcessHeap(), 0, elem->lpNSAddrHdr ); free( elem->lpNSAddrHdr );
HeapFree( GetProcessHeap(), 0, elem ); free( elem );
} }
/* Render all data in a session cache invalid */ /* Render all data in a session cache invalid */
...@@ -260,7 +258,7 @@ void NS_InvalidateSessionCache( LPVOID lpNSInfo ) ...@@ -260,7 +258,7 @@ void NS_InvalidateSessionCache( LPVOID lpNSInfo )
/* Create and initialize a session cache */ /* Create and initialize a session cache */
BOOL NS_InitializeSessionCache( LPVOID* lplpNSInfo ) BOOL NS_InitializeSessionCache( LPVOID* lplpNSInfo )
{ {
lpNSCache lpCache = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpCache ) ); lpNSCache lpCache = calloc( 1, sizeof( *lpCache ) );
*lplpNSInfo = lpCache; *lplpNSInfo = lpCache;
...@@ -371,8 +369,7 @@ void NS_ReplyToEnumSessionsRequest( const void *lpcMsg, void **lplpReplyData, DW ...@@ -371,8 +369,7 @@ void NS_ReplyToEnumSessionsRequest( const void *lpcMsg, void **lplpReplyData, DW
*lpdwReplySize = lpDP->dp2->spData.dwSPHeaderSize + *lpdwReplySize = lpDP->dp2->spData.dwSPHeaderSize +
sizeof( *rmsg ) + dwVariableSize; sizeof( *rmsg ) + dwVariableSize;
*lplpReplyData = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, *lplpReplyData = calloc( 1, *lpdwReplySize );
*lpdwReplySize );
rmsg = (LPDPMSG_ENUMSESSIONSREPLY)( (BYTE*)*lplpReplyData + rmsg = (LPDPMSG_ENUMSESSIONSREPLY)( (BYTE*)*lplpReplyData +
lpDP->dp2->spData.dwSPHeaderSize); lpDP->dp2->spData.dwSPHeaderSize);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment