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

Unified Diff: runtime/vm/snapshot.cc

Issue 2629533002: Fix leak of message snapshot buffer when attempting to send an illegal object. (Closed)
Patch Set: Created 3 years, 11 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 | « runtime/vm/snapshot.h ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot.cc
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index 13757ecbaee8aaf041b4e0b7ba23ad9f7a4d8d12..55d8a3cd2f4b076f088fad766f478c9e5fe031c3 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -1218,10 +1218,11 @@ SnapshotWriter::SnapshotWriter(Thread* thread,
Snapshot::Kind kind,
uint8_t** buffer,
ReAlloc alloc,
+ DeAlloc dealloc,
intptr_t initial_size,
ForwardList* forward_list,
bool can_send_any_object)
- : BaseWriter(buffer, alloc, initial_size),
+ : BaseWriter(buffer, alloc, dealloc, initial_size),
thread_(thread),
kind_(kind),
object_store_(isolate()->object_store()),
@@ -1883,6 +1884,7 @@ ScriptSnapshotWriter::ScriptSnapshotWriter(uint8_t** buffer, ReAlloc alloc)
Snapshot::kScript,
buffer,
alloc,
+ NULL,
kInitialSize,
&forward_list_,
true /* can_send_any_object */),
@@ -1932,11 +1934,13 @@ void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) {
MessageWriter::MessageWriter(uint8_t** buffer,
ReAlloc alloc,
+ DeAlloc dealloc,
bool can_send_any_object)
: SnapshotWriter(Thread::Current(),
Snapshot::kMessage,
buffer,
alloc,
+ dealloc,
kInitialSize,
&forward_list_,
can_send_any_object),
@@ -1957,6 +1961,7 @@ void MessageWriter::WriteMessage(const Object& obj) {
NoSafepointScope no_safepoint;
WriteObject(obj.raw());
} else {
+ FreeBuffer();
ThrowException(exception_type(), exception_msg());
}
}
« no previous file with comments | « runtime/vm/snapshot.h ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698