Michael Stefaniuc (@mstefani) commented about dlls/dmsynth/synthsink.c:
+ struct synth_sink *sink = params->sink; + WAVEFORMATEX format; + DWORD samples_size; + short *samples; + HRESULT hr; + + TRACE("Starting thread, args %p\n", args); + SetThreadDescription(GetCurrentThread(), L"wine_dmsynth_sink_render"); + + if (FAILED(hr = IDirectSoundBuffer_GetCaps(buffer, &caps))) + ERR("Failed to query sound buffer caps, hr %#lx.\n", hr); + else if (FAILED(hr = IDirectSoundBuffer_GetFormat(buffer, &format, sizeof(format), NULL))) + ERR("Failed to query sound buffer format, hr %#lx.\n", hr); + samples_size = WRITE_PERIOD * format.nSamplesPerSec / 1000 * format.nBlockAlign; if (!(samples = malloc(samples_size))) If the `IDirectSoundBuffer_GetCaps()` fails then `IDirectSoundBuffer_GetFormat()` won't be called and format will be uninitialized.\ As `format.nSamplesPerSec` is used to calculate the malloc size we might allocate some garbage size there.
Also `IDirectSoundBuffer_GetFormat()` might leave `format` uninitialized on some errors. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9651#note_127346