Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: core/src/fxcodec/jbig2/JBig2_Object.cpp

Issue 1230763007: Make CJBig2_Object::operator delete accept nullptr (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcodec/jbig2/JBig2_Object.cpp
diff --git a/core/src/fxcodec/jbig2/JBig2_Object.cpp b/core/src/fxcodec/jbig2/JBig2_Object.cpp
index 1429a91644d19fa2478fe845385980d80703b1b9..ae544d72d5b7d25a408417f5b114c3d3ecbea7ae 100644
--- a/core/src/fxcodec/jbig2/JBig2_Object.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_Object.cpp
@@ -1,7 +1,7 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "JBig2_Object.h"
@@ -26,7 +26,9 @@ void *CJBig2_Object::operator new(size_t size, CJBig2_Module *pModule)
}
void CJBig2_Object::operator delete(void *p)
{
- ((CJBig2_Object *)p)->m_pModule->JBig2_Free(p);
+ if (p) {
+ ((CJBig2_Object *)p)->m_pModule->JBig2_Free(p);
+ }
}
void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule)
{
@@ -64,7 +66,9 @@ void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t
}
void CJBig2_Object::operator delete[](void* p)
{
- ((CJBig2_Object *)p)->m_pModule->JBig2_Free(p);
+ if (p) {
+ ((CJBig2_Object *)p)->m_pModule->JBig2_Free(p);
+ }
}
void CJBig2_Object::operator delete[](void *p, CJBig2_Module *pModule, size_t unit_size)
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698