Clean up several CFStringRef leaks
parent
f241d88e16
commit
378aaf23ae
|
@ -135,10 +135,12 @@ static void Sound_Renderer(void *userData, AudioQueueRef queue, AudioQueueBuffer
|
||||||
err = AudioQueueStop(audioQueue, true);
|
err = AudioQueueStop(audioQueue, true);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLog(@"Error stopping stream to set device");
|
DLog(@"Error stopping stream to set device");
|
||||||
|
CFRelease(theDeviceUID);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
primed = NO;
|
primed = NO;
|
||||||
err = AudioQueueSetProperty(audioQueue, kAudioQueueProperty_CurrentDevice, &theDeviceUID, sizeof(theDeviceUID));
|
err = AudioQueueSetProperty(audioQueue, kAudioQueueProperty_CurrentDevice, &theDeviceUID, sizeof(theDeviceUID));
|
||||||
|
CFRelease(theDeviceUID);
|
||||||
if (running)
|
if (running)
|
||||||
[self start];
|
[self start];
|
||||||
}
|
}
|
||||||
|
@ -240,15 +242,21 @@ static void Sound_Renderer(void *userData, AudioQueueRef queue, AudioQueueBuffer
|
||||||
theAddress.mSelector = kAudioDevicePropertyStreamConfiguration;
|
theAddress.mSelector = kAudioDevicePropertyStreamConfiguration;
|
||||||
__Verify_noErr(AudioObjectGetPropertyDataSize(devids[i], &theAddress, 0, NULL, &propsize));
|
__Verify_noErr(AudioObjectGetPropertyDataSize(devids[i], &theAddress, 0, NULL, &propsize));
|
||||||
|
|
||||||
if (propsize < sizeof(UInt32)) continue;
|
if (propsize < sizeof(UInt32)) {
|
||||||
|
CFRelease(name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
AudioBufferList * bufferList = (AudioBufferList *) malloc(propsize);
|
AudioBufferList * bufferList = (AudioBufferList *) malloc(propsize);
|
||||||
__Verify_noErr(AudioObjectGetPropertyData(devids[i], &theAddress, 0, NULL, &propsize, bufferList));
|
__Verify_noErr(AudioObjectGetPropertyData(devids[i], &theAddress, 0, NULL, &propsize, bufferList));
|
||||||
UInt32 bufferCount = bufferList->mNumberBuffers;
|
UInt32 bufferCount = bufferList->mNumberBuffers;
|
||||||
free(bufferList);
|
free(bufferList);
|
||||||
|
|
||||||
if (!bufferCount) continue;
|
if (!bufferCount) {
|
||||||
|
CFRelease(name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL stop = NO;
|
BOOL stop = NO;
|
||||||
block([NSString stringWithString:(__bridge NSString *)name],
|
block([NSString stringWithString:(__bridge NSString *)name],
|
||||||
devids[i],
|
devids[i],
|
||||||
|
|
|
@ -75,14 +75,20 @@
|
||||||
theAddress.mSelector = kAudioDevicePropertyStreamConfiguration;
|
theAddress.mSelector = kAudioDevicePropertyStreamConfiguration;
|
||||||
__Verify_noErr(AudioObjectGetPropertyDataSize(devids[i], &theAddress, 0, NULL, &propsize));
|
__Verify_noErr(AudioObjectGetPropertyDataSize(devids[i], &theAddress, 0, NULL, &propsize));
|
||||||
|
|
||||||
if (propsize < sizeof(UInt32)) continue;
|
if (propsize < sizeof(UInt32)) {
|
||||||
|
CFRelease(name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
AudioBufferList * bufferList = (AudioBufferList *) malloc(propsize);
|
AudioBufferList * bufferList = (AudioBufferList *) malloc(propsize);
|
||||||
__Verify_noErr(AudioObjectGetPropertyData(devids[i], &theAddress, 0, NULL, &propsize, bufferList));
|
__Verify_noErr(AudioObjectGetPropertyData(devids[i], &theAddress, 0, NULL, &propsize, bufferList));
|
||||||
UInt32 bufferCount = bufferList->mNumberBuffers;
|
UInt32 bufferCount = bufferList->mNumberBuffers;
|
||||||
free(bufferList);
|
free(bufferList);
|
||||||
|
|
||||||
if (!bufferCount) continue;
|
if (!bufferCount) {
|
||||||
|
CFRelease(name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL stop = NO;
|
BOOL stop = NO;
|
||||||
block([NSString stringWithString:(__bridge NSString *)name],
|
block([NSString stringWithString:(__bridge NSString *)name],
|
||||||
|
|
Loading…
Reference in New Issue