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

Unified Diff: core/fxcrt/fx_basic_list.cpp

Issue 1991123002: Fix a potential nullptr deref in CFX_MapPtrToPtr. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/fxcrt/fx_basic_maps.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/fx_basic_list.cpp
diff --git a/core/fxcrt/fx_basic_list.cpp b/core/fxcrt/fx_basic_list.cpp
index 02afd471124acc57734c9f4c389d9cf60f93498e..f128176d00a8e46ecc6cae3ae5680697919dcdb8 100644
--- a/core/fxcrt/fx_basic_list.cpp
+++ b/core/fxcrt/fx_basic_list.cpp
@@ -73,12 +73,18 @@ void CFX_PtrList::FreeNode(CFX_PtrList::CNode* pNode) {
RemoveAll();
}
}
+
void CFX_PtrList::RemoveAll() {
m_nCount = 0;
- m_pNodeHead = m_pNodeTail = m_pNodeFree = NULL;
- m_pBlocks->FreeDataChain();
- m_pBlocks = NULL;
+ m_pNodeHead = nullptr;
+ m_pNodeTail = nullptr;
+ m_pNodeFree = nullptr;
+ if (m_pBlocks) {
+ m_pBlocks->FreeDataChain();
+ m_pBlocks = nullptr;
+ }
}
+
CFX_PtrList::CNode* CFX_PtrList::NewNode(CFX_PtrList::CNode* pPrev,
CFX_PtrList::CNode* pNext) {
if (!m_pNodeFree) {
« no previous file with comments | « no previous file | core/fxcrt/fx_basic_maps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698