Commit 3dd7c64c authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

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

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