dplayx: fixed memory leak in dplay.c (found by Smatch).

Lionel_Debroux lionel_debroux at yahoo.fr
Mon Sep 3 08:03:13 CDT 2007


DirectPlayEnumerateAW double allocates memory at two places, discarding
the result of the first allocation. Found in Michael Stefaniuc's list of
potential Wine bugs detected by Smatch.

2007-09-03  Lionel Debroux <lionel_debroux at yahoo.fr>
       * dlls/dplayx/dplay.c:
       dplayx: fixed memory leak in dplay.c (found by Smatch).



-------------- next part --------------
>From ba5356bd4e087c96d095f08a40246cb645651b3f Mon Sep 17 00:00:00 2001
From: Lionel Debroux <lionel_debroux at yahoo.fr>
Date: Mon, 3 Sep 2007 12:38:42 +0200
Subject: dplayx: fixed memory leak in dplay.c (found by Smatch).

---
 dlls/dplayx/dplay.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c
index 17ebd00..1688614 100644
--- a/dlls/dplayx/dplay.c
+++ b/dlls/dplayx/dplay.c
@@ -5292,7 +5292,6 @@ static HRESULT DirectPlayEnumerateAW(LPDPENUMDPCALLBACKA lpEnumCallbackA,
 	    {
 		HeapFree(GetProcessHeap(), 0, descriptionA);
 		max_sizeOfDescriptionA = sizeOfDescription;
-		descriptionA = HeapAlloc(GetProcessHeap(), 0, max_sizeOfDescriptionA);
 	    }
 	    descriptionA = HeapAlloc(GetProcessHeap(), 0, sizeOfDescription);
 	    RegQueryValueExA(hkServiceProvider, "DescriptionA",
@@ -5315,7 +5314,6 @@ static HRESULT DirectPlayEnumerateAW(LPDPENUMDPCALLBACKA lpEnumCallbackA,
 	    {
 		HeapFree(GetProcessHeap(), 0, descriptionW);
 		max_sizeOfDescriptionW = sizeOfDescription;
-		descriptionW = HeapAlloc(GetProcessHeap(), 0, max_sizeOfDescriptionW);
 	    }
 	    descriptionW = HeapAlloc(GetProcessHeap(), 0, sizeOfDescription);
 	    RegQueryValueExW(hkServiceProvider, descW,
-- 
1.4.4.4



More information about the wine-patches mailing list