winmm: prevent NULL dereference in MCI_Close

Jan Zerebecki jan.wine at zerebecki.de
Thu Aug 10 07:25:34 CDT 2006


If this patch is rejected from inclusion, please tell me why, as
I would have to ask anyway.

From: Jan Zerebecki <jan.wine at zerebecki.de>
Changelog:
winmm: prevent NULL dereference in MCI_Close
---

 dlls/winmm/mci.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c
index b981ab0..8985aaf 100644
--- a/dlls/winmm/mci.c
+++ b/dlls/winmm/mci.c
@@ -1797,8 +1797,13 @@ static	DWORD MCI_Close(UINT16 wDevID, DW
     MCI_UnLoadMciDriver(wmd);
 
     if (dwParam & MCI_NOTIFY)
-	mciDriverNotify((HWND)lpParms->dwCallback, wDevID,
+    {
+        HWND callback = 0;
+        if(lpParms)
+            callback = (HWND)lpParms->dwCallback;
+        mciDriverNotify(callback, wDevID,
                         (dwRet == 0) ? MCI_NOTIFY_SUCCESSFUL : MCI_NOTIFY_FAILURE);
+    }
 
     return dwRet;
 }



More information about the wine-patches mailing list