mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +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/6218>
This commit is contained in:
parent
229d9cb4e1
commit
b793c3e03b
1 changed files with 9 additions and 4 deletions
|
@ -415,6 +415,7 @@ gst_wasapi_util_get_devices (GstMMDeviceEnumerator * self,
|
||||||
GstDevice *device;
|
GstDevice *device;
|
||||||
GstStructure *props;
|
GstStructure *props;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
gboolean parse_ret;
|
||||||
|
|
||||||
hr = IMMDeviceCollection_Item (device_collection, ii, &item);
|
hr = IMMDeviceCollection_Item (device_collection, ii, &item);
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
|
@ -477,8 +478,12 @@ gst_wasapi_util_get_devices (GstMMDeviceEnumerator * self,
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_wasapi_util_parse_waveformatex ((WAVEFORMATEXTENSIBLE *) format,
|
parse_ret =
|
||||||
gst_static_caps_get (&scaps), &caps, NULL))
|
gst_wasapi_util_parse_waveformatex ((WAVEFORMATEXTENSIBLE *) format,
|
||||||
|
gst_static_caps_get (&scaps), &caps, NULL);
|
||||||
|
CoTaskMemFree (format);
|
||||||
|
|
||||||
|
if (!parse_ret)
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
/* Set some useful properties */
|
/* Set some useful properties */
|
||||||
|
@ -564,7 +569,7 @@ gst_wasapi_util_get_device_format (GstElement * self,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
format = malloc (var.blob.cbSize);
|
format = CoTaskMemAlloc (var.blob.cbSize);
|
||||||
memcpy (format, var.blob.pBlobData, var.blob.cbSize);
|
memcpy (format, var.blob.pBlobData, var.blob.cbSize);
|
||||||
|
|
||||||
PropVariantClear (&var);
|
PropVariantClear (&var);
|
||||||
|
@ -578,7 +583,7 @@ gst_wasapi_util_get_device_format (GstElement * self,
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
GST_ERROR_OBJECT (self, "AudioEngine DeviceFormat not supported");
|
GST_ERROR_OBJECT (self, "AudioEngine DeviceFormat not supported");
|
||||||
free (format);
|
CoTaskMemFree (format);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
Loading…
Reference in a new issue