diff --git a/media/extractors/mp4/MPEG4Extractor.cpp b/media/extractors/mp4/MPEG4Extractor.cpp index b6b0ae2efc..c02d2fb10c 100644 --- a/media/extractors/mp4/MPEG4Extractor.cpp +++ b/media/extractors/mp4/MPEG4Extractor.cpp @@ -365,7 +365,7 @@ MPEG4Extractor::MPEG4Extractor(DataSourceHelper *source, const char *mime) : mMoofOffset(0), mMoofFound(false), mMdatFound(false), - mDataSource(new DataSourceHelper(source)), + mDataSource(source), mCachedSource(NULL), mInitCheck(NO_INIT), mHeaderTimescale(0), diff --git a/media/extractors/ogg/OggExtractor.cpp b/media/extractors/ogg/OggExtractor.cpp index d46ace4932..4e979219a2 100644 --- a/media/extractors/ogg/OggExtractor.cpp +++ b/media/extractors/ogg/OggExtractor.cpp @@ -1220,6 +1220,7 @@ OggExtractor::OggExtractor(DataSourceHelper *source) OggExtractor::~OggExtractor() { delete mImpl; mImpl = NULL; + delete mDataSource; } size_t OggExtractor::countTracks() { diff --git a/media/extractors/wav/WAVExtractor.cpp b/media/extractors/wav/WAVExtractor.cpp index 80dc9c8ce5..c739c2a7bf 100644 --- a/media/extractors/wav/WAVExtractor.cpp +++ b/media/extractors/wav/WAVExtractor.cpp @@ -568,16 +568,14 @@ static CreatorFunc Sniff( return NULL; } - WAVExtractor *extractor = new WAVExtractor(helper); + WAVExtractor *extractor = new WAVExtractor(helper); // extractor owns the helper int numTracks = extractor->countTracks(); delete extractor; if (numTracks == 0) { - delete helper; return NULL; } *confidence = 0.3f; - delete helper; return CreateExtractor; } diff --git a/media/libstagefright/MediaExtractorFactory.cpp b/media/libstagefright/MediaExtractorFactory.cpp index 6e361497e8..7578b1e3e1 100644 --- a/media/libstagefright/MediaExtractorFactory.cpp +++ b/media/libstagefright/MediaExtractorFactory.cpp @@ -150,7 +150,8 @@ CreatorFunc MediaExtractorFactory::sniff( float newConfidence; void *newMeta = nullptr; FreeMetaFunc newFreeMeta = nullptr; - if ((curCreator = (*it)->def.sniff(source->wrap(), &newConfidence, &newMeta, &newFreeMeta))) { + if ((curCreator = (*it)->def.sniff( + source->wrap(), &newConfidence, &newMeta, &newFreeMeta))) { if (newConfidence > *confidence) { *confidence = newConfidence; if (*meta != nullptr && *freeMeta != nullptr) {