In several cases Splay data membes would not be properly initialized in ACL and MemPools code
A duplicate IP ACL value would cause an assert.
void
Splay<V>::insert(Value const &value, SPLAYCMP *compare)
{
- assert (!find (value, compare));
+ assert (find (value, compare) == NULL);
if (head == NULL)
head = new SplayNode<V>(value);
else
void
ACLARP::parse()
{
+ if (!data)
+ data = new Splay<Eui::Eui48 *>();
aclParseArpList(&data);
}
void
ACLEui64::parse()
{
+ if (!data)
+ data = new Splay<Eui::Eui64 *>();
aclParseEuiList(&data);
}
void
ACLHTTPStatus::parse()
{
+ if (!data)
+ data = new Splay<acl_httpstatus_data*>();
+
aclParseHTTPStatusList (&data);
}
/* pop each result off the list and add it to the data tree individually */
acl_ip_data *next_node = q->next;
q->next = NULL;
- data->insert(q, acl_ip_data::NetworkCompare);
+ if (!data->find(q,acl_ip_data::NetworkCompare))
+ data->insert(q, acl_ip_data::NetworkCompare);
q = next_node;
}
}
void
ACLStringData::parse()
{
- char *t;
+ if (!values)
+ values = new Splay<char *>();
+ char *t;
while ((t = strtokFile()))
values->insert(xstrdup(t), splaystrcmp);
}
ACLUserData::parse()
{
debugs(28, 2, "aclParseUserList: parsing user list");
- char *t = NULL;
+ if (!names)
+ names = new Splay<char *>();
+
+ char *t = NULL;
if ((t = ConfigParser::strtokFile())) {
debugs(28, 5, "aclParseUserList: First token is " << t);
pool->allChunks.insert(this, memCompChunks);
}
-MemPoolChunked::MemPoolChunked(const char *aLabel, size_t aSize) : MemImplementingAllocator(aLabel, aSize)
+MemPoolChunked::MemPoolChunked(const char *aLabel, size_t aSize) :
+ MemImplementingAllocator(aLabel, aSize) , chunk_size(0),
+ chunk_capacity(0), chunkCount(0), freeCache(0), nextFreeChunk(0),
+ Chunks(0), allChunks(Splay<MemChunk *>())
{
- chunk_size = 0;
- chunk_capacity = 0;
- chunkCount = 0;
- freeCache = 0;
- nextFreeChunk = 0;
- Chunks = 0;
- next = 0;
-
setChunkSize(MEM_CHUNK_SIZE);
#if HAVE_MALLOPT && M_MMAP_MAX