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

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp

Issue 1376413003: Fix a leak in PDF_DataDecode() on failure. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 2 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 <limits.h> 7 #include <limits.h>
8 #include "../../../include/fpdfapi/fpdf_parser.h" 8 #include "../../../include/fpdfapi/fpdf_parser.h"
9 #include "../../../include/fpdfapi/fpdf_module.h" 9 #include "../../../include/fpdfapi/fpdf_module.h"
10 #include "../../../include/fxcodec/fx_codec.h" 10 #include "../../../include/fxcodec/fx_codec.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 ImageEncoding = decoder; 409 ImageEncoding = decoder;
410 pImageParms = pParam; 410 pImageParms = pParam;
411 dest_buf = (uint8_t*)last_buf; 411 dest_buf = (uint8_t*)last_buf;
412 dest_size = last_size; 412 dest_size = last_size;
413 return TRUE; 413 return TRUE;
414 } 414 }
415 if (last_buf != src_buf) { 415 if (last_buf != src_buf) {
416 FX_Free(last_buf); 416 FX_Free(last_buf);
417 } 417 }
418 if (offset == -1) { 418 if (offset == -1) {
419 FX_Free(new_buf);
419 return FALSE; 420 return FALSE;
420 } 421 }
421 last_buf = new_buf; 422 last_buf = new_buf;
422 last_size = new_size; 423 last_size = new_size;
423 } 424 }
424 ImageEncoding = ""; 425 ImageEncoding = "";
425 pImageParms = NULL; 426 pImageParms = NULL;
426 dest_buf = last_buf; 427 dest_buf = last_buf;
427 dest_size = last_size; 428 dest_size = last_size;
428 return TRUE; 429 return TRUE;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 FX_DWORD src_size, 577 FX_DWORD src_size,
577 uint8_t*& dest_buf, 578 uint8_t*& dest_buf,
578 FX_DWORD& dest_size) { 579 FX_DWORD& dest_size) {
579 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); 580 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
580 if (pEncoders) { 581 if (pEncoders) {
581 return pEncoders->GetFlateModule()->FlateOrLZWDecode( 582 return pEncoders->GetFlateModule()->FlateOrLZWDecode(
582 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); 583 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size);
583 } 584 }
584 return 0; 585 return 0;
585 } 586 }
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