Bug 500777 - Crash in [@ nsMimeTypeArray::GetMimeTypes() ] while logging into QMO. r+sr=smaug
authorNochum Sossonko <highmind63@gmail.com>
Tue, 07 Jul 2009 14:13:26 +0200
changeset 30053 248555b52b97d15e448f1e1bba39e3e7dd2b9f11
parent 30052 396afe44851763f6f04016d6b0a898e6790792fe
child 30054 eb4d03b6f5f9c723182500851ff1a91a3df48983
push id7894
push userdgottwald@mozilla.com
push dateTue, 07 Jul 2009 12:15:44 +0000
treeherdermozilla-central@263cbbfeda99 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs500777
milestone1.9.2a1pre
Bug 500777 - Crash in [@ nsMimeTypeArray::GetMimeTypes() ] while logging into QMO. r+sr=smaug
dom/base/nsMimeTypeArray.cpp
--- a/dom/base/nsMimeTypeArray.cpp
+++ b/dom/base/nsMimeTypeArray.cpp
@@ -248,27 +248,27 @@ nsresult nsMimeTypeArray::GetMimeTypes()
       if (!mMimeTypeArray.SetCapacity(pluginMimeTypeCount))
         return NS_ERROR_OUT_OF_MEMORY;
 
       mPluginMimeTypeCount = pluginMimeTypeCount;
       mInited = PR_TRUE;
 
       PRUint32 k;
       for (k = 0; k < pluginCount; k++) {
-        nsIDOMPlugin* plugin = nsnull;
-        if (pluginArray->Item(k, &plugin) == NS_OK) {
+        nsCOMPtr<nsIDOMPlugin> plugin;
+        if (NS_SUCCEEDED(pluginArray->Item(k, getter_AddRefs(plugin))) &&
+            plugin) {
           PRUint32 mimeTypeCount = 0;
           if (plugin->GetLength(&mimeTypeCount) == NS_OK) {
             nsCOMPtr<nsIDOMMimeType> item;
             for (PRUint32 j = 0; j < mimeTypeCount; j++) {
               plugin->Item(j, getter_AddRefs(item));
               mMimeTypeArray.AppendObject(item);
             }
           }
-          NS_RELEASE(plugin);
         }
       }
     }
     NS_RELEASE(pluginArray);
   }
   return rv;
 }