dsound: don't free buffer if it's owned by alsa (resend)

Dan Kegel dank at kegel.com
Fri Jun 20 07:49:15 CDT 2008


This fixes the repeatable double free reported in
http://bugs.winehq.org/show_bug.cgi?id=13723
Thanks to Maarten for suggesting
how to decide whether we need to free the buffer.

Fixes the Valgrind warning:

Invalid free() / delete / delete[]
   at notify_free (heap.c:199)
   by RtlFreeHeap (heap.c:1284)
   by DirectSoundDevice_Release (dsound.c:1285)
   by IDirectSoundImpl_Release (dsound.c:304)
   by IDirectSound_IDirectSound_Release (dsound.c:442)
   by test_for_driver (ds3d.c:1004)
   by dsenum_callback (ds3d.c:1281)
   by DirectSoundEnumerateA (dsound_main.c:315)
   by ds3d_tests (ds3d.c:1324)
 Address 0x466ef78 is 0 bytes inside a block of size 65,536 free'd
   at free (vg_replace_malloc.c:323)
   by snd_pcm_munmap (in /usr/lib/libasound.so.2.0.0)
   by snd_pcm_hw_free (in /usr/lib/libasound.so.2.0.0)
   by snd_pcm_generic_hw_free (in /usr/lib/libasound.so.2.0.0)
   by snd_pcm_hw_free (in /usr/lib/libasound.so.2.0.0)
   by (within /usr/lib/libasound.so.2.0.0)
   by snd_pcm_hw_free (in /usr/lib/libasound.so.2.0.0)
   by snd_pcm_close (in /usr/lib/libasound.so.2.0.0)
   by IDsDriverBufferImpl_Release (dsoutput.c:274)
   by DSOUND_PrimaryClose (primary.c:299)
   by DSOUND_PrimaryDestroy (primary.c:331)
   by DirectSoundDevice_Release (dsound.c:1268)
   by IDirectSoundImpl_Release (dsound.c:304)
   by IDirectSound_IDirectSound_Release (dsound.c:442)
   by test_for_driver (ds3d.c:1004)
   by dsenum_callback (ds3d.c:1281)
   by DirectSoundEnumerateA (dsound_main.c:315)
   by ds3d_tests (ds3d.c:1324)
   by func_ds3d (ds3d.c:1344)
   by run_test (test.h:421)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dsound-doublefree.patch
Type: text/x-diff
Size: 679 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20080620/1f202b72/attachment.patch 


More information about the wine-patches mailing list