Bug 1142272 - platformAPI memory leak, delete on return false. r=erahm
authorHieu Le <ltronghieu1989@gmail.com>
Thu, 28 May 2015 00:32:00 -0700
changeset 269376 135fb7986b60335334f08ddc38c1f2826604fafe
parent 269375 dc3f0e384651be79b0be54f207861f9170b66b5d
child 269377 e0b03bead008235d0bc52be0dc916b4bc53af8a3
push id2501
push userjosea.olivera@gmail.com
push dateWed, 03 Jun 2015 06:55:32 +0000
reviewerserahm
bugs1142272
milestone41.0a1
Bug 1142272 - platformAPI memory leak, delete on return false. r=erahm
dom/media/gmp/GMPChild.cpp
--- a/dom/media/gmp/GMPChild.cpp
+++ b/dom/media/gmp/GMPChild.cpp
@@ -398,32 +398,35 @@ GMPChild::RecvStartPlugin()
   }
 
   auto platformAPI = new GMPPlatformAPI();
   InitPlatformAPI(*platformAPI, this);
 
   mGMPLoader = GMPProcessChild::GetGMPLoader();
   if (!mGMPLoader) {
     NS_WARNING("Failed to get GMPLoader");
+    delete platformAPI;
     return false;
   }
 
 #if defined(MOZ_GMP_SANDBOX) && defined(XP_MACOSX)
   if (!SetMacSandboxInfo()) {
     NS_WARNING("Failed to set Mac GMP sandbox info");
+    delete platformAPI;
     return false;
   }
 #endif
 
   if (!mGMPLoader->Load(libPath.get(),
                         libPath.Length(),
                         &mNodeId[0],
                         mNodeId.size(),
                         platformAPI)) {
     NS_WARNING("Failed to load GMP");
+    delete platformAPI;
     return false;
   }
 
   void* sh = nullptr;
   GMPAsyncShutdownHost* host = static_cast<GMPAsyncShutdownHost*>(this);
   GMPErr err = GetAPI(GMP_API_ASYNC_SHUTDOWN, host, &sh);
   if (err == GMPNoErr && sh) {
     mAsyncShutdown = reinterpret_cast<GMPAsyncShutdown*>(sh);