diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2026-11-08 14:53:37 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2026-11-16 18:04:59 -0600 |
| commit | 8169c72ce63ba9315888fd05fe8a7885f93e6f4f (patch) | |
| tree | 7bee5e17ba8eeb180503dc32953104d1c0b96780 /Source/Core/AudioCommon | |
| parent | 5140482a6f0e59bec1fbe843163f280ed4a2f29c (diff) | |
CubebUtils: Initialize cubeb_device_collection objects to avoid UB inside cubeb enumerate_devices calls on failure.
Diffstat (limited to 'Source/Core/AudioCommon')
| -rw-r--r-- | Source/Core/AudioCommon/CubebUtils.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/Core/AudioCommon/CubebUtils.cpp b/Source/Core/AudioCommon/CubebUtils.cpp index 0be4fdeb81..4dc34a0d44 100644 --- a/Source/Core/AudioCommon/CubebUtils.cpp +++ b/Source/Core/AudioCommon/CubebUtils.cpp @@ -83,7 +83,7 @@ std::vector<std::pair<std::string, std::string>> ListInputDevices() { std::vector<std::pair<std::string, std::string>> devices; - cubeb_device_collection collection; + cubeb_device_collection collection{}; auto cubeb_ctx = GetContext(); const int r = cubeb_enumerate_devices(cubeb_ctx.get(), CUBEB_DEVICE_TYPE_INPUT, &collection); @@ -147,7 +147,7 @@ cubeb_devid GetInputDeviceById(std::string_view id) if (id.empty()) return nullptr; - cubeb_device_collection collection; + cubeb_device_collection collection{}; auto cubeb_ctx = CubebUtils::GetContext(); const int r = cubeb_enumerate_devices(cubeb_ctx.get(), CUBEB_DEVICE_TYPE_INPUT, &collection); @@ -181,7 +181,7 @@ std::vector<std::pair<std::string, std::string>> ListOutputDevices() { std::vector<std::pair<std::string, std::string>> devices; - cubeb_device_collection collection; + cubeb_device_collection collection{}; auto cubeb_ctx = GetContext(); if (!cubeb_ctx) return devices; @@ -215,7 +215,7 @@ const void* GetOutputDeviceById(std::string_view id) if (id.empty()) return nullptr; - cubeb_device_collection collection; + cubeb_device_collection collection{}; auto cubeb_ctx = GetContext(); if (!cubeb_ctx) return nullptr; |
