www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16046] New: ScopedAllocator does not set prev, causing


          Issue ID: 16046
           Summary: ScopedAllocator does not set prev, causing segfaults
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: initrd.gz gmail.com

This code causes a segfault:

ScopedAllocator!MmapAllocator alloc;
auto foo = alloc.make!int(1).enforce;
auto bar = alloc.make!int(2).enforce;
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.

May 19 2016