mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-25 22:30:49 +08:00
Fix leaky CrashpadInfo test
CrashpadInfo::AddUserDataMinidumpStream() and UpdateUserDataMinidumpStream() allocate memory for the newly added streams. This change makes the CrashpadInfo test free that allocated memory to prevent memory leaks from these tests. This is intended to fix the ASAN failures seen on crrev.com/c/5285881: https://ci.chromium.org/ui/p/chromium/builders/try/linux_chromium_asan_rel_ng/1839072/overview Bug: crashpad:474 Change-Id: I6e030291594d22e316942a58805a177ce448053b Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5292137 Reviewed-by: Mark Mentovai <mark@chromium.org> Commit-Queue: Jesse McKenna <jessemckenna@google.com>
This commit is contained in:
parent
5075fb617a
commit
940e8a3445
@ -67,6 +67,17 @@ class CrashpadInfoTest : public testing::Test {
|
||||
ASSERT_EQ(nullptr, GetNext(current));
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
// Free the list. The list lives until process exit in production, but must
|
||||
// be freed in tests as multiple tests run in the same process.
|
||||
auto current = GetCurrentHead();
|
||||
while (current) {
|
||||
auto next = GetNext(current);
|
||||
delete current;
|
||||
current = next;
|
||||
}
|
||||
}
|
||||
|
||||
internal::UserDataMinidumpStreamListEntry* AddStream(uint32_t stream_type,
|
||||
const char* data) {
|
||||
return reinterpret_cast<internal::UserDataMinidumpStreamListEntry*>(
|
||||
|
Loading…
x
Reference in New Issue
Block a user