mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
wasapi: Fix alloc/free function mismatch
... and fix leak in wasapi device provider Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3326 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6169>
This commit is contained in:
parent
06b9864dae
commit
911d840288
1 changed files with 9 additions and 4 deletions
|
@ -407,6 +407,7 @@ gst_wasapi_util_get_devices (GstMMDeviceEnumerator * self,
|
|||
GstDevice *device;
|
||||
GstStructure *props;
|
||||
GstCaps *caps;
|
||||
gboolean parse_ret;
|
||||
|
||||
hr = IMMDeviceCollection_Item (device_collection, ii, &item);
|
||||
if (hr != S_OK)
|
||||
|
@ -469,8 +470,12 @@ gst_wasapi_util_get_devices (GstMMDeviceEnumerator * self,
|
|||
goto next;
|
||||
}
|
||||
|
||||
if (!gst_wasapi_util_parse_waveformatex ((WAVEFORMATEXTENSIBLE *) format,
|
||||
gst_static_caps_get (&scaps), &caps, NULL))
|
||||
parse_ret =
|
||||
gst_wasapi_util_parse_waveformatex ((WAVEFORMATEXTENSIBLE *) format,
|
||||
gst_static_caps_get (&scaps), &caps, NULL);
|
||||
CoTaskMemFree (format);
|
||||
|
||||
if (!parse_ret)
|
||||
goto next;
|
||||
|
||||
/* Set some useful properties */
|
||||
|
@ -556,7 +561,7 @@ gst_wasapi_util_get_device_format (GstElement * self,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
format = malloc (var.blob.cbSize);
|
||||
format = CoTaskMemAlloc (var.blob.cbSize);
|
||||
memcpy (format, var.blob.pBlobData, var.blob.cbSize);
|
||||
|
||||
PropVariantClear (&var);
|
||||
|
@ -570,7 +575,7 @@ gst_wasapi_util_get_device_format (GstElement * self,
|
|||
goto out;
|
||||
|
||||
GST_ERROR_OBJECT (self, "AudioEngine DeviceFormat not supported");
|
||||
free (format);
|
||||
CoTaskMemFree (format);
|
||||
return FALSE;
|
||||
|
||||
out:
|
||||
|
|
Loading…
Reference in a new issue