mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-30 04:48:36 +00:00
mmdevapi: Store device_name as a pointer in struct audio_client.
This commit is contained in:
parent
65880e0c8c
commit
103cd4fa7a
|
@ -623,6 +623,7 @@ static ULONG WINAPI client_Release(IAudioClient3 *iface)
|
|||
if (This->stream)
|
||||
stream_release(This->stream, This->timer_thread);
|
||||
|
||||
free(This->device_name);
|
||||
free(This);
|
||||
}
|
||||
|
||||
|
@ -1492,7 +1493,6 @@ HRESULT AudioClient_Create(GUID *guid, IMMDevice *device, IAudioClient **out)
|
|||
struct audio_client *This;
|
||||
char *name;
|
||||
EDataFlow dataflow;
|
||||
size_t size;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%s %p %p\n", debugstr_guid(guid), device, out);
|
||||
|
@ -1507,15 +1507,13 @@ HRESULT AudioClient_Create(GUID *guid, IMMDevice *device, IAudioClient **out)
|
|||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
size = strlen(name) + 1;
|
||||
This = calloc(1, FIELD_OFFSET(struct audio_client, device_name[size]));
|
||||
This = calloc(1, sizeof(*This));
|
||||
if (!This) {
|
||||
free(name);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
memcpy(This->device_name, name, size);
|
||||
free(name);
|
||||
This->device_name = name;
|
||||
|
||||
This->IAudioCaptureClient_iface.lpVtbl = &AudioCaptureClient_Vtbl;
|
||||
This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl;
|
||||
|
@ -1529,6 +1527,7 @@ HRESULT AudioClient_Create(GUID *guid, IMMDevice *device, IAudioClient **out)
|
|||
|
||||
hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->marshal);
|
||||
if (FAILED(hr)) {
|
||||
free(This->device_name);
|
||||
free(This);
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,5 @@ struct audio_client {
|
|||
struct audio_session_wrapper *session_wrapper;
|
||||
|
||||
struct list entry;
|
||||
|
||||
/* Keep at end */
|
||||
char device_name[0];
|
||||
char *device_name;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue