Fix xe_memory_is_valid.

This commit is contained in:
Ben Vanik 2013-10-20 13:47:58 -07:00
parent 9f1d2f29c1
commit e919edfb33
1 changed files with 2 additions and 2 deletions

View File

@ -332,9 +332,9 @@ int xe_memory_heap_free(
bool xe_memory_is_valid(xe_memory_ref memory, uint32_t address) {
uint8_t* p = (uint8_t*)memory->ptr + address;
if (address >= XE_MEMORY_HEAP_LOW && address < XE_MEMORY_HEAP_HIGH) {
size_t heap_guard_size = FLAGS_heap_guard_pages * 4096;
p += heap_guard_size;
// Within heap range, ask dlmalloc.
size_t heap_guard_size = FLAGS_heap_guard_pages * 4096;
p -= heap_guard_size;
return mspace_usable_size(p) > 0;
} else {
// Maybe -- could Query here (though that may be expensive).