- auto i = find_member(allocations, ptr, &Allocation::mapped_address);
- if(i==allocations.end())
+ if(!id || id>allocations.size() || !allocations[id-1].memory)
+ throw key_error(id);
+
+ Allocation &alloc = allocations[id-1];
+ if(!alloc.mapped_address)