]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix startup crash with a misconfigured (too-small) shared memory cache
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 18 Dec 2015 12:50:46 +0000 (01:50 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 18 Dec 2015 12:50:46 +0000 (01:50 +1300)
Controller condition for allocating MemStore is slightly different from
MemStore condition for allocating MemStore::map, resulting in MemStore
without a map. Until that discrepancy is fixed, be careful when
dereferencing MemStore::map.

src/MemStore.cc

index a53ecf6346a3b07433980c431c00bdd7e0346e25..d4bc939448ae9ddd29edb3d1e870329db5b24e8e 100644 (file)
@@ -725,7 +725,7 @@ MemStore::unlink(StoreEntry &e)
     if (e.mem_obj && e.mem_obj->memCache.index >= 0) {
         map->freeEntry(e.mem_obj->memCache.index);
         disconnect(e);
-    } else {
+    } else if (map) {
         // the entry may have been loaded and then disconnected from the cache
         map->freeEntryByKey(reinterpret_cast<cache_key*>(e.key));
     }