]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3661: Segmentation fault when using more than 1 worker
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 3 Oct 2012 10:18:42 +0000 (22:18 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 3 Oct 2012 10:18:42 +0000 (22:18 +1200)
Previous change to Ipc::Mem::PageStack making variable arrays into
dynamically-allocated arrays added an allocate after use bug.

src/ipc/mem/PageStack.cc

index 93616cea94af7a23993817a30c343a66d9deddca..4f3a6e18ebad310cc42b379d0c1e071f0d5b21f2 100644 (file)
@@ -17,10 +17,10 @@ Ipc::Mem::PageStack::PageStack(const uint32_t aPoolId, const unsigned int aCapac
         theSize(theCapacity),
         theLastReadable(prev(theSize)), theFirstWritable(next(theLastReadable))
 {
+    theItems=new Item[theSize];
     // initially, all pages are free
     for (Offset i = 0; i < theSize; ++i)
         theItems[i] = i + 1; // skip page number zero to keep numbers positive
-    theItems=new Item[theSize];
 }
 
 Ipc::Mem::PageStack::~PageStack()