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

Side by Side Diff: xfa/fgas/font/fgas_stdfontmgr.cpp

Issue 1925363002: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 7 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 | « xfa/fee/fde_txtedtpage.cpp ('k') | xfa/fwl/basewidget/fwl_caretimp.cpp » ('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 "xfa/fgas/font/fgas_stdfontmgr.h" 7 #include "xfa/fgas/font/fgas_stdfontmgr.h"
8 8
9 #include "core/fxcrt/include/fx_stream.h" 9 #include "core/fxcrt/include/fx_stream.h"
10 #include "xfa/fgas/crt/fgas_codepage.h" 10 #include "xfa/fgas/crt/fgas_codepage.h"
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 } 617 }
618 void CFX_FontMgrImp::Release() { 618 void CFX_FontMgrImp::Release() {
619 for (int32_t i = 0; i < m_InstalledFonts.GetSize(); i++) { 619 for (int32_t i = 0; i < m_InstalledFonts.GetSize(); i++) {
620 delete m_InstalledFonts[i]; 620 delete m_InstalledFonts[i];
621 } 621 }
622 FX_POSITION pos = m_Hash2CandidateList.GetStartPosition(); 622 FX_POSITION pos = m_Hash2CandidateList.GetStartPosition();
623 while (pos) { 623 while (pos) {
624 uint32_t dwHash; 624 uint32_t dwHash;
625 CFX_FontDescriptorInfos* pDescs; 625 CFX_FontDescriptorInfos* pDescs;
626 m_Hash2CandidateList.GetNextAssoc(pos, dwHash, pDescs); 626 m_Hash2CandidateList.GetNextAssoc(pos, dwHash, pDescs);
627 if (NULL != pDescs) { 627 delete pDescs;
628 delete pDescs;
629 }
630 } 628 }
631 pos = m_Hash2Fonts.GetStartPosition(); 629 pos = m_Hash2Fonts.GetStartPosition();
632 while (pos) { 630 while (pos) {
633 uint32_t dwHash; 631 uint32_t dwHash;
634 CFX_ArrayTemplate<IFX_Font*>* pFonts; 632 CFX_ArrayTemplate<IFX_Font*>* pFonts;
635 m_Hash2Fonts.GetNextAssoc(pos, dwHash, pFonts); 633 m_Hash2Fonts.GetNextAssoc(pos, dwHash, pFonts);
636 if (NULL != pFonts) { 634 delete pFonts;
637 delete pFonts;
638 }
639 } 635 }
640 m_Hash2Fonts.RemoveAll(); 636 m_Hash2Fonts.RemoveAll();
641 pos = m_Hash2FileAccess.GetStartPosition(); 637 pos = m_Hash2FileAccess.GetStartPosition();
642 while (pos) { 638 while (pos) {
643 uint32_t dwHash; 639 uint32_t dwHash;
644 IFX_FileAccess* pFileAccess; 640 IFX_FileAccess* pFileAccess;
645 m_Hash2FileAccess.GetNextAssoc(pos, dwHash, pFileAccess); 641 m_Hash2FileAccess.GetNextAssoc(pos, dwHash, pFileAccess);
646 if (NULL != pFileAccess) { 642 if (NULL != pFileAccess) {
647 pFileAccess->Release(); 643 pFileAccess->Release();
648 } 644 }
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 } 1196 }
1201 } 1197 }
1202 return nPenalty; 1198 return nPenalty;
1203 } 1199 }
1204 void CFX_FontMgrImp::ClearFontCache() { 1200 void CFX_FontMgrImp::ClearFontCache() {
1205 FX_POSITION pos = m_Hash2CandidateList.GetStartPosition(); 1201 FX_POSITION pos = m_Hash2CandidateList.GetStartPosition();
1206 while (pos) { 1202 while (pos) {
1207 uint32_t dwHash; 1203 uint32_t dwHash;
1208 CFX_FontDescriptorInfos* pDescs; 1204 CFX_FontDescriptorInfos* pDescs;
1209 m_Hash2CandidateList.GetNextAssoc(pos, dwHash, pDescs); 1205 m_Hash2CandidateList.GetNextAssoc(pos, dwHash, pDescs);
1210 if (NULL != pDescs) { 1206 delete pDescs;
1211 delete pDescs;
1212 }
1213 } 1207 }
1214 pos = m_FileAccess2IFXFont.GetStartPosition(); 1208 pos = m_FileAccess2IFXFont.GetStartPosition();
1215 while (pos) { 1209 while (pos) {
1216 uint32_t dwHash; 1210 uint32_t dwHash;
1217 IFX_Font* pFont; 1211 IFX_Font* pFont;
1218 m_FileAccess2IFXFont.GetNextAssoc(pos, dwHash, pFont); 1212 m_FileAccess2IFXFont.GetNextAssoc(pos, dwHash, pFont);
1219 if (NULL != pFont) { 1213 if (NULL != pFont) {
1220 pFont->Release(); 1214 pFont->Release();
1221 } 1215 }
1222 } 1216 }
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 } 1486 }
1493 } 1487 }
1494 int32_t CFX_FontMgrImp::IsPartName(const CFX_WideString& Name1, 1488 int32_t CFX_FontMgrImp::IsPartName(const CFX_WideString& Name1,
1495 const CFX_WideString& Name2) { 1489 const CFX_WideString& Name2) {
1496 if (Name1.Find(Name2.c_str()) != -1) { 1490 if (Name1.Find(Name2.c_str()) != -1) {
1497 return 1; 1491 return 1;
1498 } 1492 }
1499 return 0; 1493 return 0;
1500 } 1494 }
1501 #endif 1495 #endif
OLDNEW
« no previous file with comments | « xfa/fee/fde_txtedtpage.cpp ('k') | xfa/fwl/basewidget/fwl_caretimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698