Revision: 11471
Author: [email protected]
Date: Mon Apr 30 08:02:43 2012
Log: Don't ignore return value of CommitCodePage in
AllocateAlignedMemory.
Release the mapping as whole if commit failed to avoid leaking virtual
address space.
[email protected]
BUG=chromium:118625
Review URL: https://chromiumcodereview.appspot.com/10260012
http://code.google.com/p/v8/source/detail?r=11471
Modified:
/branches/bleeding_edge/src/spaces.cc
/branches/bleeding_edge/src/spaces.h
=======================================
--- /branches/bleeding_edge/src/spaces.cc Tue Apr 3 00:32:19 2012
+++ /branches/bleeding_edge/src/spaces.cc Mon Apr 30 08:02:43 2012
@@ -362,14 +362,21 @@
if (base == NULL) return NULL;
if (executable == EXECUTABLE) {
- CommitCodePage(&reservation, base, size);
+ if (!CommitCodePage(&reservation, base, size)) {
+ base = NULL;
+ }
} else {
- if (!reservation.Commit(base,
- size,
- executable == EXECUTABLE)) {
- return NULL;
+ if (!reservation.Commit(base, size, false)) {
+ base = NULL;
}
}
+
+ if (base == NULL) {
+ // Failed to commit the body. Release the mapping and any partially
+ // commited regions inside it.
+ reservation.Release();
+ return NULL;
+ }
controller->TakeControl(&reservation);
return base;
=======================================
--- /branches/bleeding_edge/src/spaces.h Thu Apr 12 03:06:32 2012
+++ /branches/bleeding_edge/src/spaces.h Mon Apr 30 08:02:43 2012
@@ -1042,7 +1042,9 @@
return CodePageAreaEndOffset() - CodePageAreaStartOffset();
}
- static bool CommitCodePage(VirtualMemory* vm, Address start, size_t
size);
+ MUST_USE_RESULT static bool CommitCodePage(VirtualMemory* vm,
+ Address start,
+ size_t size);
private:
Isolate* isolate_;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev