dplayx: Reorder some code to avoid memory leak (coverity).

This commit is contained in:
André Hentschel 2012-10-29 20:16:36 +01:00 committed by Alexandre Julliard
parent 32f8548d67
commit 3dd7c64c25
1 changed files with 4 additions and 9 deletions

View File

@ -1126,10 +1126,6 @@ DP_SetGroupData( lpGroupData lpGData, DWORD dwFlags,
/* Reallocate for new data */
if( lpData != NULL )
{
LPVOID lpNewData = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof( dwDataSize ) );
CopyMemory( lpNewData, lpData, dwDataSize );
if( dwFlags & DPSET_LOCAL )
{
lpGData->lpLocalData = lpData;
@ -1137,7 +1133,8 @@ DP_SetGroupData( lpGroupData lpGData, DWORD dwFlags,
}
else
{
lpGData->lpRemoteData = lpNewData;
lpGData->lpRemoteData = HeapAlloc( GetProcessHeap(), 0, dwDataSize );
CopyMemory( lpGData->lpRemoteData, lpData, dwDataSize );
lpGData->dwRemoteDataSize = dwDataSize;
}
}
@ -1330,9 +1327,6 @@ DP_SetPlayerData( lpPlayerData lpPData, DWORD dwFlags,
/* Reallocate for new data */
if( lpData != NULL )
{
LPVOID lpNewData = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof( dwDataSize ) );
CopyMemory( lpNewData, lpData, dwDataSize );
if( dwFlags & DPSET_LOCAL )
{
@ -1341,7 +1335,8 @@ DP_SetPlayerData( lpPlayerData lpPData, DWORD dwFlags,
}
else
{
lpPData->lpRemoteData = lpNewData;
lpPData->lpRemoteData = HeapAlloc( GetProcessHeap(), 0, dwDataSize );
CopyMemory( lpPData->lpRemoteData, lpData, dwDataSize );
lpPData->dwRemoteDataSize = dwDataSize;
}
}