diff --git a/xpcom/base/VisualEventTracer.cpp b/xpcom/base/VisualEventTracer.cpp index 73de6235f03e..f6b7d401a747 100644 --- a/xpcom/base/VisualEventTracer.cpp +++ b/xpcom/base/VisualEventTracer.cpp @@ -466,25 +466,17 @@ Shutdown() RecordBatch::DeleteLog(); - if (gMonitor) { - delete gMonitor; - gMonitor = nullptr; - } + delete gMonitor; + gMonitor = nullptr; - if (gEventFilter) { - delete gEventFilter; - gEventFilter = nullptr; - } + delete gEventFilter; + gEventFilter = nullptr; - if (gProfilerStart) { - delete gProfilerStart; - gProfilerStart = nullptr; - } + delete gProfilerStart; + gProfilerStart = nullptr; - if (gMaxBacklogTime) { - delete gMaxBacklogTime; - gMaxBacklogTime = nullptr; - } + delete gMaxBacklogTime; + gMaxBacklogTime = nullptr; #endif } diff --git a/xpcom/build/nsXPComInit.cpp b/xpcom/build/nsXPComInit.cpp index c48df0b15268..daaeaa465a3f 100644 --- a/xpcom/build/nsXPComInit.cpp +++ b/xpcom/build/nsXPComInit.cpp @@ -974,31 +974,27 @@ ShutdownXPCOM(nsIServiceManager* servMgr) NS_IF_RELEASE(gDebug); - if (sIOThread) { - delete sIOThread; - sIOThread = nullptr; - } - if (sMessageLoop) { - delete sMessageLoop; - sMessageLoop = nullptr; - } + delete sIOThread; + sIOThread = nullptr; + + delete sMessageLoop; + sMessageLoop = nullptr; + if (sCommandLineWasInitialized) { CommandLine::Terminate(); sCommandLineWasInitialized = false; } - if (sExitManager) { - delete sExitManager; - sExitManager = nullptr; - } + + delete sExitManager; + sExitManager = nullptr; Omnijar::CleanUp(); HangMonitor::Shutdown(); - if (sMainHangMonitor) { - delete sMainHangMonitor; - sMainHangMonitor = nullptr; - } + delete sMainHangMonitor; + sMainHangMonitor = nullptr; + BackgroundHangMonitor::Shutdown(); #ifdef MOZ_VISUAL_EVENT_TRACER diff --git a/xpcom/components/nsCategoryManager.cpp b/xpcom/components/nsCategoryManager.cpp index a5003a26f4ab..546694a4b34d 100644 --- a/xpcom/components/nsCategoryManager.cpp +++ b/xpcom/components/nsCategoryManager.cpp @@ -83,9 +83,7 @@ protected: virtual ~BaseStringEnumerator() { - if (mArray) { - delete[] mArray; - } + delete [] mArray; } void Sort(); diff --git a/xpcom/io/nsNativeCharsetUtils.cpp b/xpcom/io/nsNativeCharsetUtils.cpp index 76445696271d..8f7b500e45a4 100644 --- a/xpcom/io/nsNativeCharsetUtils.cpp +++ b/xpcom/io/nsNativeCharsetUtils.cpp @@ -400,10 +400,8 @@ nsNativeCharsetConverter::GlobalInit() void nsNativeCharsetConverter::GlobalShutdown() { - if (gLock) { - delete gLock; - gLock = nullptr; - } + delete gLock; + gLock = nullptr; if (gNativeToUnicode != INVALID_ICONV_T) { iconv_close(gNativeToUnicode); diff --git a/xpcom/tests/TestThreadPoolListener.cpp b/xpcom/tests/TestThreadPoolListener.cpp index 9b0b10a41259..92e08a3912d3 100644 --- a/xpcom/tests/TestThreadPoolListener.cpp +++ b/xpcom/tests/TestThreadPoolListener.cpp @@ -122,10 +122,8 @@ public: } ~AutoCreateAndDestroyReentrantMonitor() { - if (*mReentrantMonitorPtr) { - delete *mReentrantMonitorPtr; - *mReentrantMonitorPtr = nullptr; - } + delete *mReentrantMonitorPtr; + *mReentrantMonitorPtr = nullptr; } private: