diff options
| author | Keegan McAllister <kmcallister@mozilla.com> | 2013-07-16 14:26:20 -0700 |
|---|---|---|
| committer | Keegan McAllister <kmcallister@mozilla.com> | 2013-07-17 14:03:59 -0700 |
| commit | dfa5595628651f55bda7437c80631d596c8b61f9 (patch) | |
| tree | 04140d6f119e72b88aba61d5d47a0fada461b837 /src/rt/memory_region.cpp | |
| parent | 060de1016b280732308452f25eb90810deaba002 (diff) | |
| download | rust-dfa5595628651f55bda7437c80631d596c8b61f9.tar.gz rust-dfa5595628651f55bda7437c80631d596c8b61f9.zip | |
rt: Diagnose bad alloc index in release_alloc with RUSTRT_TRACK_ALLOCATIONS
Diffstat (limited to 'src/rt/memory_region.cpp')
| -rw-r--r-- | src/rt/memory_region.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rt/memory_region.cpp b/src/rt/memory_region.cpp index f3406712cb0..15cac3ef79b 100644 --- a/src/rt/memory_region.cpp +++ b/src/rt/memory_region.cpp @@ -203,6 +203,11 @@ memory_region::release_alloc(void *mem) { # if RUSTRT_TRACK_ALLOCATIONS >= 2 if (_synchronized) { _lock.lock(); } + if (((size_t) alloc->index) >= _allocation_list.size()) { + printf("free: ptr 0x%" PRIxPTR " (%s) index %d is beyond allocation_list of size %zu\n", + (uintptr_t) get_data(alloc), alloc->tag, alloc->index, _allocation_list.size()); + assert(false && "index beyond allocation_list"); + } if (_allocation_list[alloc->index] != alloc) { printf("free: ptr 0x%" PRIxPTR " (%s) is not in allocation_list\n", (uintptr_t) get_data(alloc), alloc->tag); |
