8286519: Better memory handling
Reviewed-by: coleenp, rhalade
This commit is contained in:
parent
48cc9a8717
commit
c622d56a0d
@ -655,6 +655,11 @@ void* os::malloc(size_t size, MEMFLAGS memflags, const NativeCallStack& stack) {
|
||||
|
||||
const size_t outer_size = size + MemTracker::overhead_per_malloc();
|
||||
|
||||
// Check for overflow.
|
||||
if (outer_size < size) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ALLOW_C_FUNCTION(::malloc, void* const outer_ptr = ::malloc(outer_size);)
|
||||
if (outer_ptr == NULL) {
|
||||
return NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user