summaryrefslogtreecommitdiff
path: root/apt-pkg/indexfile.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/indexfile.cc')
-rw-r--r--apt-pkg/indexfile.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/apt-pkg/indexfile.cc b/apt-pkg/indexfile.cc
index 657cdfb36..894671bae 100644
--- a/apt-pkg/indexfile.cc
+++ b/apt-pkg/indexfile.cc
@@ -325,12 +325,18 @@ pkgDebianIndexFile::~pkgDebianIndexFile()
pkgCacheListParser * pkgDebianIndexFile::CreateListParser(FileFd &Pkg)
{
if (Pkg.IsOpen() == false)
- return NULL;
+ return nullptr;
_error->PushToStack();
pkgCacheListParser * const Parser = new debListParser(&Pkg);
bool const newError = _error->PendingError();
_error->MergeWithStack();
- return newError ? NULL : Parser;
+ if (newError)
+ {
+ delete Parser;
+ return nullptr;
+ }
+ else
+ return Parser;
}
bool pkgDebianIndexFile::Merge(pkgCacheGenerator &Gen,OpProgress * const Prog)
{