From 3641ef266c514ad981e42f81a80f268a4b542070 Mon Sep 17 00:00:00 2001 From: Justin Hawkwood Date: Mon, 30 Mar 2015 16:24:48 -0700 Subject: [PATCH] Remove use of autorelease NSString and NSURL Since there is no autorelease pool, these were leaking. --- cocos/audio/apple/AudioCache.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cocos/audio/apple/AudioCache.mm b/cocos/audio/apple/AudioCache.mm index 9afa0054be..6a4265f9ba 100644 --- a/cocos/audio/apple/AudioCache.mm +++ b/cocos/audio/apple/AudioCache.mm @@ -99,8 +99,10 @@ void AudioCache::readDataTask() AudioBufferList theDataBuffer; ExtAudioFileRef extRef = nullptr; - auto fileURL = (CFURLRef)[[NSURL fileURLWithPath:[NSString stringWithCString:_fileFullPath.c_str() encoding:[NSString defaultCStringEncoding]]] retain]; - + NSString *fileFullPath = [[NSString alloc] initWithCString:_fileFullPath.c_str() encoding:[NSString defaultCStringEncoding]]; + auto fileURL = (CFURLRef)[[NSURL alloc] initFileURLWithPath:fileFullPath]; + [fileFullPath release]; + auto error = ExtAudioFileOpenURL(fileURL, &extRef); if(error) { printf("%s: ExtAudioFileOpenURL FAILED, Error = %ld\n", __PRETTY_FUNCTION__, (long)error);