From: Christos Tsantilas Date: Mon, 16 Jun 2014 16:16:10 +0000 (+0300) Subject: Assure that when LruMap::memLimit_ is set to 0 no entries stored on LruMap X-Git-Tag: SQUID_3_5_0_1~180 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c661b1c92b69707f957a3690fc6acbe3d73dc8e9;p=thirdparty%2Fsquid.git Assure that when LruMap::memLimit_ is set to 0 no entries stored on LruMap Changes: - Do not add new entries to LruMap if memLimit is 0 - Remove all entries in LruMap::trim if memLimit set to 0 --- diff --git a/src/base/LruMap.h b/src/base/LruMap.h index c68a4fe02d..c3ca9f784b 100644 --- a/src/base/LruMap.h +++ b/src/base/LruMap.h @@ -140,6 +140,10 @@ LruMap::add(const char *key, EntryValue *t) del(key); trim(); + + if (memLimit() == 0) + return false; + index.push_front(new Entry(key, t)); storage.insert(MapPair(key, index.begin())); @@ -185,7 +189,7 @@ template void LruMap::trim() { - while (memLimit() > 0 && size() >= memLimit()) { + while (memLimit() >= 0 && size() >= memLimit()) { QueueIterator i = index.end(); --i; if (i != index.end()) {