diff options
author | David Kalnischkies <david@kalnischkies.de> | 2015-09-11 21:02:19 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2015-09-14 15:22:18 +0200 |
commit | 830a1b8c9e9a26dc1101167ac66a75c444902c4d (patch) | |
tree | c8846c6a98eb81e95d0b4459b146d8075b7f0913 /apt-pkg | |
parent | ae732225ec2fa0d7434c9f40a92ced8683752211 (diff) |
fix two memory leaks reported by gcc
Reported-By: gcc -fsanitize=address -fno-sanitize=vptr
Git-Dch: Ignore
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/metaindex.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc index 1632b928c..5c095a2ad 100644 --- a/apt-pkg/metaindex.cc +++ b/apt-pkg/metaindex.cc @@ -32,12 +32,15 @@ metaIndex::metaIndex(std::string const &URI, std::string const &Dist, metaIndex::~metaIndex() { - if (Indexes == 0) - return; - for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); - I != (*Indexes).end(); ++I) - delete *I; - delete Indexes; + if (Indexes != 0) + { + for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); + I != (*Indexes).end(); ++I) + delete *I; + delete Indexes; + } + for (auto const &E: Entries) + delete E.second; } // one line Getters for public fields /*{{{*/ |