https://bugs.winehq.org/show_bug.cgi?id=42546
--- Comment #5 from Ivan_83 rozhuk.im@gmail.com --- Yes, I will try it.
But this patch will allocate less then: new_buflen = ((frames + 1) * wfx->nBlockAlign * sizeof(float)); and new_buflen = (frames * sizeof(float)); - I have test it and it cause crash.
wfx->nBlockAlign - in most cases I see =2, sizeof(float)=4. And it does not change: device->fraglen = frag_frames * wfx->nBlockAlign; device->aclen = aclen_frames * wfx->nBlockAlign; so device->fraglen and device->aclen will be bigger (in some cases) than device->buflen and allocated mem size. Next, device->fraglen and device->aclen will be used some where and corrupt heap...again.
IMHO, refactoring needed and DSOUND_PrimaryOpen() should be included into DSOUND_ReopenDevice() and all sizes should be calculated and set in ONE(!!!) place. All playing with patch DSOUND_PrimaryOpen() is waste of time.