diff options
author | George McCollister <george.mccollister@gmail.com> | 2013-08-01 12:40:01 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-08-02 11:25:45 -0400 |
commit | 8e6d9397b550f5617fc9231e3a275348cda23c89 (patch) | |
tree | 011c2396e2240382ec344a0fd778c27536ba1461 /src/journal/mmap-cache.c | |
parent | 3b6c7e78cf38c1cad8fbb44d21e40ebf69c7cc77 (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.c | 4 |
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); |