winecfg: Fix Crash when no Audio driver is found.

Pierre d'Herbemont stegefin at free.fr
Fri Dec 30 12:10:07 CST 2005


Hi,

This patch should fix the crash on winecfg when selecting the audio  
tab in winecfg on Mac OS X (or more generally when no audio driver is  
present).

Pierre.

ChangeLog:
Prevent a crash when no audio driver is found.

programs/winecfg/audio.c |    7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
ef561cfc8b20a0b8f19bf3a4119a41d62fceb240
diff --git a/programs/winecfg/audio.c b/programs/winecfg/audio.c
index 3d78e92..7905f39 100644
--- a/programs/winecfg/audio.c
+++ b/programs/winecfg/audio.c
@@ -495,7 +495,12 @@ static void findAudioDrivers(void)
      SetCursor(old_cursor);

      /* terminate list with empty driver */
-    loadedAudioDrv = HeapReAlloc(GetProcessHeap(), 0,  
loadedAudioDrv, (numFound + 1) * sizeof(AUDIO_DRIVER));
+
+    if(numFound == 0)
+        loadedAudioDrv = HeapAlloc(GetProcessHeap(), 0, sizeof 
(AUDIO_DRIVER));
+    else
+        loadedAudioDrv = HeapReAlloc(GetProcessHeap(), 0,  
loadedAudioDrv, (numFound + 1) * sizeof(AUDIO_DRIVER));
+
      CopyMemory(&loadedAudioDrv[numFound], pAudioDrv, sizeof 
(AUDIO_DRIVER));
  }




More information about the wine-patches mailing list