if (file.IsOpen() == false || file.Failed())
return false;
Map = new MMap(file, MMap::Public|MMap::ReadOnly);
+ if (unlikely(Map->validData() == false))
+ return false;
Cache = new pkgCache(Map);
return _error->PendingError() == false;
}
BuildSourceList(Progress);
// Read the caches
- bool Res = pkgCacheGenerator::MakeStatusCache(*SrcList,Progress,&Map, true);
+ Cache = nullptr;
+ bool Res = pkgCacheGenerator::MakeStatusCache(*SrcList,Progress,&Map, &Cache, true);
if (Progress != NULL)
Progress->Done();
if (Res == false)
if (_error->PendingError() == true)
_error->Warning(_("You may want to run apt-get update to correct these problems"));
- Cache = new pkgCache(Map);
+ if (Cache == nullptr)
+ Cache = new pkgCache(Map);
if (_error->PendingError() == true)
return false;
return true;