Bug 16046 – ScopedAllocator does not set prev, causing segfaults
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-05-19T14:09:00Z
Last change time
2016-10-01T11:46:50Z
Assigned to
nobody
Creator
initrd.gz
Comments
Comment #0 by initrd.gz — 2016-05-19T14:09:59Z
This code causes a segfault:
ScopedAllocator!MmapAllocator alloc;
auto foo = alloc.make!int(1).enforce;
auto bar = alloc.make!int(2).enforce;
alloc.dispose(foo);
alloc.dispose(bar); // segfault here
This is likely because ScopedAllocator.allocate does not set the prev pointer of the old root when prepending a new node, so prev will always be null.