Bug 1021932 - Free the buffer on failure in MediaBufferDecoder::AsyncDecodeMedia. r=padenot
authorAndrew McCreight <continuation@gmail.com>
Sun, 22 Jun 2014 11:10:08 -0700
changeset 189960 e3ab11ba56a5f9ddbbf83cfbdbdedcbe53660eae
parent 189959 2b483618e693efaab3fa7e3f67ddb64ec41ad505
child 189961 35c527229cdba117043ea9878c7399773dee8902
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerspadenot
bugs1021932
milestone33.0a1
Bug 1021932 - Free the buffer on failure in MediaBufferDecoder::AsyncDecodeMedia. r=padenot
content/media/webaudio/MediaBufferDecoder.cpp
--- a/content/media/webaudio/MediaBufferDecoder.cpp
+++ b/content/media/webaudio/MediaBufferDecoder.cpp
@@ -445,25 +445,27 @@ MediaBufferDecoder::AsyncDecodeMedia(con
   // Do not attempt to decode the media if we were not successful at sniffing
   // the content type.
   if (!*aContentType ||
       strcmp(aContentType, APPLICATION_OCTET_STREAM) == 0) {
     nsCOMPtr<nsIRunnable> event =
       new ReportResultTask(aDecodeJob,
                            &WebAudioDecodeJob::OnFailure,
                            WebAudioDecodeJob::UnknownContent);
+    JS_free(nullptr, aBuffer);
     NS_DispatchToMainThread(event);
     return;
   }
 
   if (!EnsureThreadPoolInitialized()) {
     nsCOMPtr<nsIRunnable> event =
       new ReportResultTask(aDecodeJob,
                            &WebAudioDecodeJob::OnFailure,
                            WebAudioDecodeJob::UnknownError);
+    JS_free(nullptr, aBuffer);
     NS_DispatchToMainThread(event);
     return;
   }
 
   MOZ_ASSERT(mThreadPool);
 
   nsRefPtr<MediaDecodeTask> task =
     new MediaDecodeTask(aContentType, aBuffer, aLength, aDecodeJob, mThreadPool);