[PATCH] mmsystem.dll16: free the correct pointer (Coverity)

Marcus Meissner marcus at jet.franken.de
Wed Jan 1 12:26:02 CST 2014


712653 Free of address-of expression
---
 dlls/mmsystem.dll16/mci16.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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;
-- 
1.7.10.4




More information about the wine-patches mailing list