Re: [systemd-devel] [PATCH] fixed hashmap leaks in mmap-cache

2013-08-02 Thread Zbigniew Jędrzejewski-Szmek
On Thu, Aug 01, 2013 at 12:40:01PM -0500, George McCollister wrote:
 hashmap_free() wasn't being called on m-contexts and m-fds resulting
 in a leak.
Applied, thanks.

 
 To reproduce do:
   while(1) {
   sd_journal_open(j, SD_JOURNAL_LOCAL_ONLY);
   sd_journal_close(j);
   }
I turned this into a minimalistic test, just to exercise more code
paths in the test suite.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] fixed hashmap leaks in mmap-cache

2013-08-01 Thread George McCollister
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.

Signed-off-by: George McCollister george.mccollis...@gmail.com
---
 src/journal/mmap-cache.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c
index 767f555..03b57be 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);
 
-- 
1.8.2.1

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel