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

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

Issue 1365903002: Fix a leak in CJBig2_Context. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nit 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 | core/src/fxcodec/jbig2/JBig2_Context.h » ('j') | 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() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 m_pJbig2Context->m_src_buf = (unsigned char*)src_buf; 47 m_pJbig2Context->m_src_buf = (unsigned char*)src_buf;
48 m_pJbig2Context->m_src_size = src_size; 48 m_pJbig2Context->m_src_size = src_size;
49 m_pJbig2Context->m_global_data = global_data; 49 m_pJbig2Context->m_global_data = global_data;
50 m_pJbig2Context->m_global_size = global_size; 50 m_pJbig2Context->m_global_size = global_size;
51 m_pJbig2Context->m_dest_buf = dest_buf; 51 m_pJbig2Context->m_dest_buf = dest_buf;
52 m_pJbig2Context->m_dest_pitch = dest_pitch; 52 m_pJbig2Context->m_dest_pitch = dest_pitch;
53 m_pJbig2Context->m_pPause = pPause; 53 m_pJbig2Context->m_pPause = pPause;
54 m_pJbig2Context->m_bFileReader = FALSE; 54 m_pJbig2Context->m_bFileReader = FALSE;
55 FXSYS_memset(dest_buf, 0, height * dest_pitch); 55 FXSYS_memset(dest_buf, 0, height * dest_pitch);
56 m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext( 56 m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext(
57 global_data, global_size, src_buf, src_size, JBIG2_EMBED_STREAM, 57 global_data, global_size, src_buf, src_size, &m_SymbolDictCache, pPause);
58 &m_SymbolDictCache, pPause);
59 if (!m_pJbig2Context->m_pContext) { 58 if (!m_pJbig2Context->m_pContext) {
60 return FXCODEC_STATUS_ERROR; 59 return FXCODEC_STATUS_ERROR;
61 } 60 }
62 int ret = m_pJbig2Context->m_pContext->getFirstPage(dest_buf, width, height, 61 int ret = m_pJbig2Context->m_pContext->getFirstPage(dest_buf, width, height,
63 dest_pitch, pPause); 62 dest_pitch, pPause);
64 if (m_pJbig2Context->m_pContext->GetProcessingStatus() == 63 if (m_pJbig2Context->m_pContext->GetProcessingStatus() ==
65 FXCODEC_STATUS_DECODE_FINISH) { 64 FXCODEC_STATUS_DECODE_FINISH) {
66 CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext); 65 CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext);
67 m_pJbig2Context->m_pContext = NULL; 66 m_pJbig2Context->m_pContext = NULL;
68 if (ret != JBIG2_SUCCESS) { 67 if (ret != JBIG2_SUCCESS) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return FXCODEC_STATUS_ERROR; 102 return FXCODEC_STATUS_ERROR;
104 } 103 }
105 int dword_size = 104 int dword_size =
106 m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4; 105 m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4;
107 FX_DWORD* dword_buf = (FX_DWORD*)m_pJbig2Context->m_dest_buf; 106 FX_DWORD* dword_buf = (FX_DWORD*)m_pJbig2Context->m_dest_buf;
108 for (int i = 0; i < dword_size; i++) { 107 for (int i = 0; i < dword_size; i++) {
109 dword_buf[i] = ~dword_buf[i]; 108 dword_buf[i] = ~dword_buf[i];
110 } 109 }
111 return FXCODEC_STATUS_DECODE_FINISH; 110 return FXCODEC_STATUS_DECODE_FINISH;
112 } 111 }
OLDNEW
« no previous file with comments | « no previous file | core/src/fxcodec/jbig2/JBig2_Context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698