summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcache.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2021-02-03 10:55:09 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2021-02-03 17:36:45 +0100
commitcd1f75854824b3db7ba86039463528f834a0838a (patch)
treed76b5a546951b5cf9fe2b92fe464fc353ffeeb18 /apt-pkg/pkgcache.cc
parentc8d65a59a36400aaf85ff96b0c813f8fc53cd8bb (diff)
Free XXH3 state to avoid leak in cache hashing
We do this once (usually), so the leak is tremendously big, but it is detected as a leak by the fuzzer and trips it up.
Diffstat (limited to 'apt-pkg/pkgcache.cc')
-rw-r--r--apt-pkg/pkgcache.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index f7f3537aa..cbde7c42f 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -255,7 +255,9 @@ uint32_t pkgCache::CacheHash()
GetMap().Size() - sizeof(header));
}
- return XXH3_64bits_digest(state) & 0xFFFFFFFF;
+ auto const digest = XXH3_64bits_digest(state);
+ XXH3_freeState(state);
+ return digest & 0xFFFFFFFF;
}
/*}}}*/
// Cache::FindPkg - Locate a package by name /*{{{*/