summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 17:03:33 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 17:03:33 +0000
commit506a66fe1cdcd16253591fd8d262516914ca624b (patch)
treee4c7e35b155106aed6127cff6892a2efa133ea27 /apt-pkg
parent98c6365aa8d1cab4e523b480d52b52d5c1797de3 (diff)
* Small bugfix to pkgRecords to prevent a segfault if t...
Author: mdz Date: 2003-09-02 04:46:18 GMT * Small bugfix to pkgRecords to prevent a segfault if the pkgCache is destroyed before it (from Conectiva's apt-rpm)
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/pkgrecords.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/apt-pkg/pkgrecords.cc b/apt-pkg/pkgrecords.cc
index 69aac6622..a7dec76a7 100644
--- a/apt-pkg/pkgrecords.cc
+++ b/apt-pkg/pkgrecords.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: pkgrecords.cc,v 1.6 2001/02/20 07:03:17 jgg Exp $
+// $Id: pkgrecords.cc,v 1.7 2003/09/02 04:46:18 mdz Exp $
/* ######################################################################
Package Records - Allows access to complete package description records
@@ -42,6 +42,10 @@ pkgRecords::pkgRecords(pkgCache &Cache) : Cache(Cache), Files(0)
if (Files[I->ID] == 0)
return;
}
+
+ // We store this 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 +53,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;
}