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

Unified Diff: core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp

Issue 2273293003: Check for nullptrs in CPDF_Dictionary dtor. (Closed)
Patch Set: nit Created 4 years, 4 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
Index: core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
index 8fef074d4bd184ded1d831f406f4ec470b85cbf1..e79bac1839f98330d6246f73ab7fdf6c8c4c35c0 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
@@ -6,6 +6,9 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
+#include <set>
+#include <utility>
+
#include "core/fpdfapi/fpdf_parser/cpdf_boolean.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h"
@@ -18,9 +21,13 @@
CPDF_Dictionary::CPDF_Dictionary() {}
CPDF_Dictionary::~CPDF_Dictionary() {
+ // Mark the object as deleted so that it will not be deleted again
+ // in case of cyclic references.
m_ObjNum = kInvalidObjNum;
- for (const auto& it : m_Map)
- it.second->Release();
+ for (const auto& it : m_Map) {
+ if (it.second)
+ it.second->Release();
+ }
}
CPDF_Object::Type CPDF_Dictionary::GetType() const {

Powered by Google App Engine
This is Rietveld 408576698