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.
Comment #1 by andrei — 2016-08-22T16:58:44Z
Comment #2 by github-bugzilla — 2016-08-24T23:26:36Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/54a5e49b2a95a51f473f1c0f72fb3d5dca498fc9 Fix issue 16046 - ScopedAllocator does not set prev, causing segfaults https://github.com/dlang/phobos/commit/7ab18cd5ecbee121df6223747884a63252978304 Merge pull request #4742 from andralex/16046 Fix issue 16046 - ScopedAllocator does not set prev, causing segfaults
Comment #3 by github-bugzilla — 2016-10-01T11:46:50Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/54a5e49b2a95a51f473f1c0f72fb3d5dca498fc9 Fix issue 16046 - ScopedAllocator does not set prev, causing segfaults https://github.com/dlang/phobos/commit/7ab18cd5ecbee121df6223747884a63252978304 Merge pull request #4742 from andralex/16046