Fix potential minor memory leaks in BGMPreferredOutputDevices.

This commit is contained in:
Kyle Neideck 2019-03-27 13:36:19 +11:00
parent df9815a4be
commit a40dfde439
No known key found for this signature in database
GPG key ID: CAA8D9B8E39EC18C

View file

@ -125,7 +125,7 @@ NSString* const kAudioSystemSettingsPlist =
BGM_Utils::LogAndSwallowExceptions(BGMDbgArgs, [&] {
BGMAudioDevice defaultDevice = CAHALAudioSystemObject().GetDefaultAudioDevice(false, false);
NSString* __nullable defaultDeviceUID =
(__bridge NSString* __nullable)defaultDevice.CopyDeviceUID();
(__bridge_transfer NSString* __nullable)defaultDevice.CopyDeviceUID();
if (defaultDeviceUID) {
preferredOutputDeviceInfos = @[ @{ @"uid": BGMNN(defaultDeviceUID) } ];
@ -459,7 +459,7 @@ NSString* const kAudioSystemSettingsPlist =
BGM_Utils::LogAndSwallowExceptions(BGMDbgArgs, [&] {
// Add the new output device to the list.
NSString* __nullable outputDeviceUID =
(__bridge NSString* __nullable)CAHALAudioDevice(device).CopyDeviceUID();
(__bridge_transfer NSString* __nullable)CAHALAudioDevice(device).CopyDeviceUID();
if (outputDeviceUID) {
// Limit the list to three devices because that's what macOS does.