Bug 1334104 - 'if' statement is unnecessary draft
authorCliff <cliffplaysdrums@gmail.com>
Mon, 30 Jan 2017 19:38:40 -0500
changeset 468325 aea9dba8e388e78fbc4f28e498965a7cceed6672
parent 467834 71224049c0b52ab190564d3ea0eab089a159a4cf
child 543910 6fc32f61a497671bb342d6ba7a6cf1f6d73da8db
push id43423
push userbmo:cliffplaysdrums@gmail.com
push dateTue, 31 Jan 2017 01:16:25 +0000
bugs1334104
milestone54.0a1
Bug 1334104 - 'if' statement is unnecessary Removed unnecessary `if` statements intended to safely delete pointers. Deleting a null pointer has no effect, and the behavior is defined. MozReview-Commit-ID: 5zfMZoPoWcY
dom/plugins/base/nsPluginHost.cpp
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -3130,33 +3130,31 @@ nsPluginHost::ReadPluginInfo()
       if (line != mtr)
         break;
       mimetypes[mtr] = values[1];
       mimedescriptions[mtr] = values[2];
       extensions[mtr] = values[3];
     }
 
     if (mtr != mimetypecount) {
-      if (heapalloced) {
-        delete [] heapalloced;
-      }
+      delete [] heapalloced;
       return rv;
     }
 
     RefPtr<nsPluginTag> tag = new nsPluginTag(name,
       description,
       filename,
       fullpath,
       version,
       (const char* const*)mimetypes,
       (const char* const*)mimedescriptions,
       (const char* const*)extensions,
       mimetypecount, lastmod, fromExtension, true);
-    if (heapalloced)
-      delete [] heapalloced;
+
+    delete [] heapalloced;
 
     // Import flags from registry into prefs for old registry versions
     MOZ_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_BASIC,
       ("LoadCachedPluginsInfo : Loading Cached plugininfo for %s\n", tag->FileName().get()));
 
     if (!ShouldAddPlugin(tag)) {
       continue;
     }