winecfg: Fix audio crash when no drivers are available.

This commit is contained in:
Robert Reif 2006-05-07 23:28:40 -04:00 committed by Alexandre Julliard
parent b4a5df1c19
commit 6f4e208321
1 changed files with 7 additions and 2 deletions

View File

@ -519,8 +519,13 @@ static void findAudioDrivers(void)
SetCursor(old_cursor);
/* terminate list with empty driver */
loadedAudioDrv = HeapReAlloc(GetProcessHeap(), 0, loadedAudioDrv, (numFound + 1) * sizeof(AUDIO_DRIVER));
CopyMemory(&loadedAudioDrv[numFound], pAudioDrv, sizeof(AUDIO_DRIVER));
if (numFound) {
loadedAudioDrv = HeapReAlloc(GetProcessHeap(), 0, loadedAudioDrv, (numFound + 1) * sizeof(AUDIO_DRIVER));
CopyMemory(&loadedAudioDrv[numFound], pAudioDrv, sizeof(AUDIO_DRIVER));
} else {
loadedAudioDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(AUDIO_DRIVER));
ZeroMemory(&loadedAudioDrv[0], sizeof(AUDIO_DRIVER));
}
}
/* check local copy of registry string for unloadable drivers */