Index: minidump/minidump_simple_string_dictionary_writer.cc |
diff --git a/minidump/minidump_simple_string_dictionary_writer.cc b/minidump/minidump_simple_string_dictionary_writer.cc |
index ef3a1eca176d4ad0cb12cb6a941b3f81ab7ecbfc..9218bd9786597a7c08e3cc484194d217e33a1eae 100644 |
--- a/minidump/minidump_simple_string_dictionary_writer.cc |
+++ b/minidump/minidump_simple_string_dictionary_writer.cc |
@@ -15,6 +15,7 @@ |
#include "minidump/minidump_simple_string_dictionary_writer.h" |
#include "base/logging.h" |
+#include "base/stl_util.h" |
#include "util/file/file_writer.h" |
#include "util/numeric/safe_assignment.h" |
@@ -92,13 +93,21 @@ MinidumpSimpleStringDictionaryWriter::MinidumpSimpleStringDictionaryWriter() |
} |
MinidumpSimpleStringDictionaryWriter::~MinidumpSimpleStringDictionaryWriter() { |
+ STLDeleteContainerPairSecondPointers(entries_.begin(), entries_.end()); |
} |
void MinidumpSimpleStringDictionaryWriter::AddEntry( |
- MinidumpSimpleStringDictionaryEntryWriter* entry) { |
+ scoped_ptr<MinidumpSimpleStringDictionaryEntryWriter> entry) { |
DCHECK_GE(state(), kStateMutable); |
- entries_[entry->Key()] = entry; |
+ const std::string& key = entry->Key(); |
+ auto iterator = entries_.find(key); |
+ if (iterator != entries_.end()) { |
+ delete iterator->second; |
+ iterator->second = entry.release(); |
+ } else { |
+ entries_[key] = entry.release(); |
+ } |
} |
bool MinidumpSimpleStringDictionaryWriter::Freeze() { |