From 44a8f8d14ebfd3e0a9619afe81eddac5677c8fca Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Fri, 29 Sep 2017 13:03:22 +0200 Subject: [PATCH] Fix some memory leaks. --- MP42/MP42AVFImporter.m | 9 ++++++--- MP42/MP42Track.m | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MP42/MP42AVFImporter.m b/MP42/MP42AVFImporter.m index 296b4dd..ab3345f 100644 --- a/MP42/MP42AVFImporter.m +++ b/MP42/MP42AVFImporter.m @@ -976,10 +976,10 @@ CFArrayRef attachmentsArray = CMSampleBufferGetSampleAttachmentsArray(sampleBuffer, NO); if (attachmentsArray) { for (NSDictionary *dict in (NSArray *)attachmentsArray) { - if ([dict valueForKey:(NSString *)kCMSampleAttachmentKey_NotSync]) { + if (dict[(NSString *)kCMSampleAttachmentKey_NotSync]) { sync = 0; } - if ([dict valueForKey:(NSString *)kCMSampleAttachmentKey_DoNotDisplay]) { + if (dict[(NSString *)kCMSampleAttachmentKey_DoNotDisplay]) { doNotDisplay = YES; } } @@ -1149,6 +1149,9 @@ demuxHelper->currentTime = currentOutputTimeStamp.value; + if (attachments) { + CFRelease(attachments); + } free(timingArrayOut); free(sizeArrayOut); } @@ -1182,7 +1185,7 @@ } self.progress = (((CGFloat) currentDataLength / totalDataLength ) * 100); - currentTime += 2; + currentTime += 1; } [assetReader release]; diff --git a/MP42/MP42Track.m b/MP42/MP42Track.m index 6ea3831..80d33a2 100644 --- a/MP42/MP42Track.m +++ b/MP42/MP42Track.m @@ -128,6 +128,7 @@ if (tag) { [mediaCharacteristicTags addObject:tag]; } + free(ppValue); } count++;