Marcus Meissner : mmsystem.dll16: Free the correct pointer (Coverity).

Alexandre Julliard julliard at winehq.org
Wed Jan 1 14:24:21 CST 2014


Module: wine
Branch: master
Commit: a21c489f0fc50f04a8e19ee9fdbd5a50f5927be1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a21c489f0fc50f04a8e19ee9fdbd5a50f5927be1

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Wed Jan  1 19:26:02 2014 +0100

mmsystem.dll16: Free the correct pointer (Coverity).

---

 dlls/mmsystem.dll16/mci16.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dlls/mmsystem.dll16/mci16.c b/dlls/mmsystem.dll16/mci16.c
index ad27405..2ad82a6 100644
--- a/dlls/mmsystem.dll16/mci16.c
+++ b/dlls/mmsystem.dll16/mci16.c
@@ -323,12 +323,14 @@ static MMSYSTEM_MapType	MCI_MapMsg16To32W(WORD wMsg, DWORD dwFlags, DWORD_PTR* l
 	return MMSYSTEM_MAP_OKMEM;
     case MCI_SYSINFO:
     {
+        MCI_SYSINFO_PARMSW *origmsip32w;
         MCI_SYSINFO_PARMSW *msip32w = HeapAlloc(GetProcessHeap(), 0, sizeof(MCI_OPEN_PARMS16 *) + sizeof(MCI_SYSINFO_PARMSW));
         MCI_SYSINFO_PARMS16 *msip16 = MapSL(*lParam);
 
         if (!msip32w)
             return MMSYSTEM_MAP_NOMEM;
 
+        origmsip32w = msip32w;
         *(MCI_SYSINFO_PARMS16 **)msip32w = msip16;
         msip32w = (MCI_SYSINFO_PARMSW *)((char *)msip32w + sizeof(MCI_OPEN_PARMS16 *));
         msip32w->dwCallback       = msip16->dwCallback;
@@ -337,7 +339,7 @@ static MMSYSTEM_MapType	MCI_MapMsg16To32W(WORD wMsg, DWORD dwFlags, DWORD_PTR* l
                                                                     msip16->dwRetSize * sizeof(WCHAR));
         if (!msip32w->lpstrReturn)
         {
-            HeapFree(GetProcessHeap(), 0, msip32w);
+            HeapFree(GetProcessHeap(), 0, origmsip32w);
             return MMSYSTEM_MAP_NOMEM;
         }
         msip32w->dwRetSize        = (dwFlags & MCI_SYSINFO_QUANTITY) ? sizeof(DWORD) : msip16->dwRetSize;




More information about the wine-cvs mailing list