Nikolay Sivov : dplayx: Fix a possible memory leak on error path (Coverity ).
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Nov 23 09:59:46 CST 2015
Module: wine
Branch: master
Commit: bd9701add87316d94f72294b947683dc265d1c82
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bd9701add87316d94f72294b947683dc265d1c82
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun Nov 22 18:31:20 2015 +0300
dplayx: Fix a possible memory leak on error path (Coverity).
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dplayx/dplay.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c
index 861c090..92062d3 100644
--- a/dlls/dplayx/dplay.c
+++ b/dlls/dplayx/dplay.c
@@ -1593,17 +1593,12 @@ static HRESULT DP_IF_CreatePlayer( IDirectPlayImpl *This, void *lpMsgHdr, DPID *
player total */
lpPData = DP_CreatePlayer( This, lpidPlayer, lpPlayerName, dwCreateFlags,
hEvent, bAnsi );
-
- if( lpPData == NULL )
- {
- return DPERR_CANTADDPLAYER;
- }
-
/* Create the list object and link it in */
lpPList = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpPList ) );
- if( lpPList == NULL )
+ if( !lpPData || !lpPList )
{
- FIXME( "Memory leak\n" );
+ HeapFree( GetProcessHeap(), 0, lpPData );
+ HeapFree( GetProcessHeap(), 0, lpPList );
return DPERR_CANTADDPLAYER;
}
More information about the wine-cvs
mailing list