summaryrefslogtreecommitdiff
path: root/apt-pkg/indexfile.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-03-25 13:08:06 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2016-04-03 14:44:47 +0200
commitc48ef8942d87388a67af9e2cad92171aca3be731 (patch)
treed9f0fcbbb197d26bf1912c3735cd9a21e2f97f19 /apt-pkg/indexfile.cc
parent46c4043d741cb2c1d54e7f5bfaa234f1b7580f6c (diff)
don't leak on error in listparser creation
Git-Dch: Ignore Reported-By: gcc -fsanitize=address
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)
{