aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cubeb_audiounit.cpp
diff options
context:
space:
mode:
authorChun-Min Chang <[email protected]>2019-03-08 11:35:49 -0800
committerPaul Adenot <[email protected]>2019-03-11 15:12:10 -0400
commit681d4b7ee6d098f35ea853eb12825ed40cb64156 (patch)
tree04cde251fff1e64f4d3369ebf564fc520491e623 /src/cubeb_audiounit.cpp
parentb0140a50bf15a0795de507d7254a67a33fa444b2 (diff)
downloadcubeb-681d4b7ee6d098f35ea853eb12825ed40cb64156.tar.gz
cubeb-681d4b7ee6d098f35ea853eb12825ed40cb64156.zip
Release the CFStringRef object when it's no longer needed
Diffstat (limited to 'src/cubeb_audiounit.cpp')
-rw-r--r--src/cubeb_audiounit.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cubeb_audiounit.cpp b/src/cubeb_audiounit.cpp
index f1b053e..10204ed 100644
--- a/src/cubeb_audiounit.cpp
+++ b/src/cubeb_audiounit.cpp
@@ -1683,6 +1683,9 @@ audiounit_create_blank_aggregate_device(AudioObjectID * plugin_id, AudioDeviceID
return CUBEB_OK;
}
+// The returned CFStringRef object needs to be released (via CFRelease)
+// if it's not NULL, since the reference count of the returned CFStringRef
+// object is increased.
static CFStringRef
get_device_name(AudioDeviceID id)
{
@@ -1715,6 +1718,7 @@ audiounit_set_aggregate_sub_device_list(AudioDeviceID aggregate_device_id,
return CUBEB_ERROR;
}
CFArrayAppendValue(aggregate_sub_devices_array, ref);
+ CFRelease(ref);
}
for (UInt32 i = 0; i < input_sub_devices.size(); i++) {
CFStringRef ref = get_device_name(input_sub_devices[i]);
@@ -1723,6 +1727,7 @@ audiounit_set_aggregate_sub_device_list(AudioDeviceID aggregate_device_id,
return CUBEB_ERROR;
}
CFArrayAppendValue(aggregate_sub_devices_array, ref);
+ CFRelease(ref);
}
AudioObjectPropertyAddress aggregate_sub_device_list = { kAudioAggregateDevicePropertyFullSubDeviceList,
@@ -1764,6 +1769,9 @@ audiounit_set_master_aggregate_device(const AudioDeviceID aggregate_device_id)
NULL,
size,
&master_sub_device);
+ if (master_sub_device) {
+ CFRelease(master_sub_device);
+ }
if (rv != noErr) {
LOG("AudioObjectSetPropertyData/kAudioAggregateDevicePropertyMasterSubDevice, rv=%d", rv);
return CUBEB_ERROR;
@@ -3430,6 +3438,9 @@ audiounit_get_devices_of_type(cubeb_device_type devtype)
} else {
it++;
}
+ if (name) {
+ CFRelease(name);
+ }
}
/* Expected sorted but did not find anything in the docs. */