diff options
author | thestig <thestig@chromium.org> | 2016-08-25 11:14:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-25 11:14:21 -0700 |
commit | 22b176d0ee7f1dcbc7bca6e5eef65c19fa10f726 (patch) | |
tree | 7de5141f0e33e65930b252773cbf242441fb7b5f /core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp | |
parent | 695aac5f1f53088659f9b525a692002044e3b098 (diff) | |
download | pdfium-22b176d0ee7f1dcbc7bca6e5eef65c19fa10f726.tar.xz |
Check for nullptrs in CPDF_Dictionary dtor.
BUG=597440
Review-Url: https://codereview.chromium.org/2273293003
Diffstat (limited to 'core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp')
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp index 8fef074d4b..e79bac1839 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 { |