Check for NULL pointers in CJBig2_SymbolDict::DeepCopy().
[pdfium.git] / core / src / fxcodec / jbig2 / JBig2_Segment.cpp
index 788207d..b7eed35 100644 (file)
@@ -1,53 +1,53 @@
-// Copyright 2014 PDFium Authors. All rights reserved.\r
-// Use of this source code is governed by a BSD-style license that can be\r
-// found in the LICENSE file.\r
\r
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
-\r
-#include "JBig2_Segment.h"\r
-CJBig2_Segment::CJBig2_Segment()\r
-{\r
-    init();\r
-}\r
-CJBig2_Segment::~CJBig2_Segment()\r
-{\r
-    clean();\r
-}\r
-void CJBig2_Segment::init()\r
-{\r
-    m_dwNumber = 0;\r
-    m_cFlags.c = 0;\r
-    m_nReferred_to_segment_count = 0;\r
-    m_pReferred_to_segment_numbers = NULL;\r
-    m_dwPage_association = 0;\r
-    m_dwData_length = 0;\r
-    m_dwHeader_Length = 0;\r
-    m_pData = NULL;\r
-    m_State = JBIG2_SEGMENT_HEADER_UNPARSED;\r
-    m_nResultType = JBIG2_VOID_POINTER;\r
-    m_Result.vd = NULL;\r
-}\r
-void CJBig2_Segment::clean()\r
-{\r
-    if(m_pReferred_to_segment_numbers) {\r
-        m_pModule->JBig2_Free(m_pReferred_to_segment_numbers);\r
-    }\r
-    if(m_Result.vd) {\r
-        switch(m_nResultType) {\r
-            case JBIG2_IMAGE_POINTER:\r
-                delete m_Result.im;\r
-                break;\r
-            case JBIG2_SYMBOL_DICT_POINTER:\r
-                delete m_Result.sd;\r
-                break;\r
-            case JBIG2_PATTERN_DICT_POINTER:\r
-                delete m_Result.pd;\r
-                break;\r
-            case JBIG2_HUFFMAN_TABLE_POINTER:\r
-                delete m_Result.ht;\r
-                break;\r
-            default:\r
-                m_pModule->JBig2_Free(m_Result.vd);\r
-        }\r
-    }\r
-}\r
+// 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_Segment.h"
+CJBig2_Segment::CJBig2_Segment()
+{
+    init();
+}
+CJBig2_Segment::~CJBig2_Segment()
+{
+    clean();
+}
+void CJBig2_Segment::init()
+{
+    m_dwNumber = 0;
+    m_cFlags.c = 0;
+    m_nReferred_to_segment_count = 0;
+    m_pReferred_to_segment_numbers = NULL;
+    m_dwPage_association = 0;
+    m_dwData_length = 0;
+    m_dwHeader_Length = 0;
+    m_pData = NULL;
+    m_State = JBIG2_SEGMENT_HEADER_UNPARSED;
+    m_nResultType = JBIG2_VOID_POINTER;
+    m_Result.vd = NULL;
+}
+void CJBig2_Segment::clean()
+{
+    if(m_pReferred_to_segment_numbers) {
+        m_pModule->JBig2_Free(m_pReferred_to_segment_numbers);
+    }
+    if(m_Result.vd) {
+        switch(m_nResultType) {
+            case JBIG2_IMAGE_POINTER:
+                delete m_Result.im;
+                break;
+            case JBIG2_SYMBOL_DICT_POINTER:
+                delete m_Result.sd;
+                break;
+            case JBIG2_PATTERN_DICT_POINTER:
+                delete m_Result.pd;
+                break;
+            case JBIG2_HUFFMAN_TABLE_POINTER:
+                delete m_Result.ht;
+                break;
+            default:
+                m_pModule->JBig2_Free(m_Result.vd);
+        }
+    }
+}