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

Side by Side Diff: core/src/fxcodec/codec/fx_codec_jbig.cpp

Issue 1346043003: Fix a leak in CJBig2_CachePair. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../include/fxcodec/fx_codec.h" 7 #include "../../../include/fxcodec/fx_codec.h"
8 #include "codec_int.h" 8 #include "codec_int.h"
9 9
10 CCodec_Jbig2Context::CCodec_Jbig2Context() { 10 CCodec_Jbig2Context::CCodec_Jbig2Context() {
11 FXSYS_memset(this, 0, sizeof(CCodec_Jbig2Context)); 11 FXSYS_memset(this, 0, sizeof(CCodec_Jbig2Context));
12 } 12 }
13 CCodec_Jbig2Module::~CCodec_Jbig2Module() {} 13
14 CCodec_Jbig2Module::~CCodec_Jbig2Module() {
15 for (auto it : m_SymbolDictCache) {
16 delete it.second;
17 }
18 }
19
14 void* CCodec_Jbig2Module::CreateJbig2Context() { 20 void* CCodec_Jbig2Module::CreateJbig2Context() {
15 return new CCodec_Jbig2Context(); 21 return new CCodec_Jbig2Context();
16 } 22 }
17 void CCodec_Jbig2Module::DestroyJbig2Context(void* pJbig2Content) { 23 void CCodec_Jbig2Module::DestroyJbig2Context(void* pJbig2Content) {
18 if (pJbig2Content) { 24 if (pJbig2Content) {
19 CJBig2_Context::DestroyContext( 25 CJBig2_Context::DestroyContext(
20 ((CCodec_Jbig2Context*)pJbig2Content)->m_pContext); 26 ((CCodec_Jbig2Context*)pJbig2Content)->m_pContext);
21 delete (CCodec_Jbig2Context*)pJbig2Content; 27 delete (CCodec_Jbig2Context*)pJbig2Content;
22 } 28 }
23 pJbig2Content = NULL; 29 pJbig2Content = NULL;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return FXCODEC_STATUS_ERROR; 103 return FXCODEC_STATUS_ERROR;
98 } 104 }
99 int dword_size = 105 int dword_size =
100 m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4; 106 m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4;
101 FX_DWORD* dword_buf = (FX_DWORD*)m_pJbig2Context->m_dest_buf; 107 FX_DWORD* dword_buf = (FX_DWORD*)m_pJbig2Context->m_dest_buf;
102 for (int i = 0; i < dword_size; i++) { 108 for (int i = 0; i < dword_size; i++) {
103 dword_buf[i] = ~dword_buf[i]; 109 dword_buf[i] = ~dword_buf[i];
104 } 110 }
105 return FXCODEC_STATUS_DECODE_FINISH; 111 return FXCODEC_STATUS_DECODE_FINISH;
106 } 112 }
OLDNEW
« 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