summaryrefslogtreecommitdiff
path: root/src/journal/mmap-cache.c
diff options
context:
space:
mode:
authorGeorge McCollister <george.mccollister@gmail.com>2013-08-01 12:40:01 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-08-02 11:25:45 -0400
commit8e6d9397b550f5617fc9231e3a275348cda23c89 (patch)
tree011c2396e2240382ec344a0fd778c27536ba1461 /src/journal/mmap-cache.c
parent3b6c7e78cf38c1cad8fbb44d21e40ebf69c7cc77 (diff)
journal: fix hashmap leak in mmap-cache
hashmap_free() wasn't being called on m->contexts and m->fds resulting in a leak. To reproduce do: while(1) { sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY); sd_journal_close(j); } Memory usage will increase until OOM.
Diffstat (limited to 'src/journal/mmap-cache.c')
-rw-r--r--src/journal/mmap-cache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c
index 767f555526..03b57beb04 100644
--- a/src/journal/mmap-cache.c
+++ b/src/journal/mmap-cache.c
@@ -307,9 +307,13 @@ static void mmap_cache_free(MMapCache *m) {
while ((c = hashmap_first(m->contexts)))
context_free(c);
+ hashmap_free(m->contexts);
+
while ((f = hashmap_first(m->fds)))
fd_free(f);
+ hashmap_free(m->fds);
+
while (m->unused)
window_free(m->unused);