]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3661: Segmentation fault when using more than 1 worker
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 6 Oct 2012 02:27:30 +0000 (20:27 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 6 Oct 2012 02:27:30 +0000 (20:27 -0600)
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 25d84975078c01e916a531cfbaef57903fa494ef..fea71d272b12fde88f4d76e442070725a7e6a839 100644 (file)
@@ -20,10 +20,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()