Jinoh Kang (@iamahuman) commented about dlls/windows.media.speech/recognizer.c:
- if (FAILED(hr = IAudioClient_Initialize(session->audio_client, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, buffer_duration, 0, wfx, NULL)))
goto cleanup;
- if (FAILED(hr = IAudioClient_SetEventHandle(session->audio_client, session->audio_buf_event)))
goto cleanup;
- hr = IAudioClient_GetService(session->audio_client, &IID_IAudioCaptureClient, (void**)&session->capture_client);
+cleanup:
- if (FAILED(hr))
- {
if (session->audio_client) IAudioClient_Release(session->audio_client);
if (session->audio_buf_event) CloseHandle(session->audio_buf_event);
- }
- if (wfx) CoTaskMemFree(wfx);
```suggestion:-0+0 CoTaskMemFree(wfx); ```
From https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi...:
`[in, optional] pv`
A pointer to the memory block to be freed. If this parameter is **NULL**, the function has no effect.