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, 2 insertions, 8 deletions
diff --git a/apt-pkg/indexfile.cc b/apt-pkg/indexfile.cc
index 934943205..b860e2335 100644
--- a/apt-pkg/indexfile.cc
+++ b/apt-pkg/indexfile.cc
@@ -338,16 +338,10 @@ pkgCacheListParser * pkgDebianIndexFile::CreateListParser(FileFd &Pkg)
if (Pkg.IsOpen() == false)
return nullptr;
_error->PushToStack();
- pkgCacheListParser * const Parser = new debListParser(&Pkg);
+ std::unique_ptr<pkgCacheListParser> Parser(new debListParser(&Pkg));
bool const newError = _error->PendingError();
_error->MergeWithStack();
- if (newError)
- {
- delete Parser;
- return nullptr;
- }
- else
- return Parser;
+ return newError ? nullptr : Parser.release();
}
bool pkgDebianIndexFile::Merge(pkgCacheGenerator &Gen,OpProgress * const Prog)
{