diff options
author | David Kalnischkies <david@kalnischkies.de> | 2015-06-18 17:33:15 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2015-08-10 17:25:25 +0200 |
commit | 3d8232bf97ce11818fb07813a71136484ea1a44a (patch) | |
tree | c7e1e3885e952f7ab8171e1cf4b425ddccb5606f /apt-private/private-cacheset.h | |
parent | c3392a9fccc04129816057b1184c651171034376 (diff) |
fix memory leaks reported by -fsanitize
Various small leaks here and there. Nothing particularily big, but still
good to fix. Found by the sanitizers while running our testcases.
Reported-By: gcc -fsanitize
Git-Dch: Ignore
Diffstat (limited to 'apt-private/private-cacheset.h')
-rw-r--r-- | apt-private/private-cacheset.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apt-private/private-cacheset.h b/apt-private/private-cacheset.h index 059c7637e..0eb22b788 100644 --- a/apt-private/private-cacheset.h +++ b/apt-private/private-cacheset.h @@ -32,10 +32,15 @@ struct VersionSortDescriptionLocality bool operator () (const pkgCache::VerIterator &v_lhs, const pkgCache::VerIterator &v_rhs) { - pkgCache::DescFile *A = v_lhs.TranslatedDescription().FileList(); - pkgCache::DescFile *B = v_rhs.TranslatedDescription().FileList(); - if (A == 0 && B == 0) - return false; + pkgCache::DescFile const *A = NULL; + pkgCache::DescFile const *B = NULL; + if (v_lhs->DescriptionList != 0) + A = v_lhs.TranslatedDescription().FileList(); + if (v_rhs->DescriptionList != 0) + B = v_rhs.TranslatedDescription().FileList(); + + if (A == 0 && B == 0) + return false; if (A == 0) return true; |