 Chromium Code Reviews
 Chromium Code Reviews Issue 1408063016:
  Fix a leak in CPDF_Type3Font::LoadChar().  (Closed) 
  Base URL: https://pdfium.googlesource.com/pdfium@parser_b268
    
  
    Issue 1408063016:
  Fix a leak in CPDF_Type3Font::LoadChar().  (Closed) 
  Base URL: https://pdfium.googlesource.com/pdfium@parser_b268| OLD | NEW | 
|---|---|
| 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/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" | 
| 8 #include "../../../include/fpdfapi/fpdf_render.h" | 8 #include "../../../include/fpdfapi/fpdf_render.h" | 
| 9 #include "../../../include/fpdfapi/fpdf_pageobj.h" | 9 #include "../../../include/fpdfapi/fpdf_pageobj.h" | 
| 10 #include "../fpdf_page/pageint.h" | 10 #include "../fpdf_page/pageint.h" | 
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 } | 121 } | 
| 122 line += line_step; | 122 line += line_step; | 
| 123 } | 123 } | 
| 124 return -1; | 124 return -1; | 
| 125 } | 125 } | 
| 126 CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, | 126 CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, | 
| 127 FX_DWORD charcode, | 127 FX_DWORD charcode, | 
| 128 const CFX_AffineMatrix* pMatrix, | 128 const CFX_AffineMatrix* pMatrix, | 
| 129 FX_FLOAT retinaScaleX, | 129 FX_FLOAT retinaScaleX, | 
| 130 FX_FLOAT retinaScaleY) { | 130 FX_FLOAT retinaScaleY) { | 
| 131 CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode); | 131 const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode); | 
| 132 if (pChar == NULL || pChar->m_pBitmap == NULL) { | 132 if (pChar == NULL || pChar->m_pBitmap == NULL) { | 
| 
Tom Sepez
2015/11/08 04:46:29
nit: nullptr twice here and next line.
 
Lei Zhang
2015/11/09 20:27:26
Done.
 | |
| 133 return NULL; | 133 return NULL; | 
| 134 } | 134 } | 
| 135 CFX_DIBitmap* pBitmap = pChar->m_pBitmap; | 135 CFX_DIBitmap* pBitmap = pChar->m_pBitmap; | 
| 136 CFX_AffineMatrix image_matrix, text_matrix; | 136 CFX_AffineMatrix image_matrix, text_matrix; | 
| 137 image_matrix = pChar->m_ImageMatrix; | 137 image_matrix = pChar->m_ImageMatrix; | 
| 138 text_matrix.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0); | 138 text_matrix.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0); | 
| 139 image_matrix.Concat(text_matrix); | 139 image_matrix.Concat(text_matrix); | 
| 140 CFX_DIBitmap* pResBitmap = NULL; | 140 CFX_DIBitmap* pResBitmap = NULL; | 
| 141 int left, top; | 141 int left, top; | 
| 142 if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 && | 142 if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 && | 
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 790 ProcessPath(&path, pObj2Device); | 790 ProcessPath(&path, pObj2Device); | 
| 791 } | 791 } | 
| 792 } | 792 } | 
| 793 | 793 | 
| 794 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) { | 794 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) { | 
| 795 int glyph_index = GlyphFromCharCode(charcode); | 795 int glyph_index = GlyphFromCharCode(charcode); | 
| 796 if (!m_Font.GetFace()) | 796 if (!m_Font.GetFace()) | 
| 797 return nullptr; | 797 return nullptr; | 
| 798 return m_Font.LoadGlyphPath(glyph_index, dest_width); | 798 return m_Font.LoadGlyphPath(glyph_index, dest_width); | 
| 799 } | 799 } | 
| OLD | NEW |