X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/073895a5aa258ee76249267fe8699631062644f8..e0c4f06387ade5761e644b5b96e41284c12da23c:/apt-pkg/pkgrecords.cc diff --git a/apt-pkg/pkgrecords.cc b/apt-pkg/pkgrecords.cc index b22f3e73f..f62f945b5 100644 --- a/apt-pkg/pkgrecords.cc +++ b/apt-pkg/pkgrecords.cc @@ -42,6 +42,9 @@ pkgRecords::pkgRecords(pkgCache &Cache) : Cache(Cache), Files(0) if (Files[I->ID] == 0) return; } + // We store that to make sure that the destructor won't segfault, + // even if the Cache object was destructed before this instance. + PackageFileCount = Cache.HeaderP->PackageFileCount; } /*}}}*/ // Records::~pkgRecords - Destructor /*{{{*/ @@ -49,7 +52,7 @@ pkgRecords::pkgRecords(pkgCache &Cache) : Cache(Cache), Files(0) /* */ pkgRecords::~pkgRecords() { - for (unsigned I = 0; I != Cache.HeaderP->PackageFileCount; I++) + for (unsigned I = 0; I != PackageFileCount; I++) delete Files[I]; delete [] Files; }