[Issue 16046] New: ScopedAllocator does not set prev, causing segfaults

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu May 19 07:09:59 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16046

          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 at puremagic.com
          Reporter: initrd.gz at 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(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.

--


More information about the Digitalmars-d-bugs mailing list