]> err.no Git - systemd/commitdiff
journal-file: fix mmap leak
authorMichal Schmidt <mschmidt@redhat.com>
Tue, 12 Jun 2012 14:45:09 +0000 (16:45 +0200)
committerTollef Fog Heen <tfheen@err.no>
Fri, 29 Jun 2012 20:40:09 +0000 (22:40 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=831132

src/journal/journal-file.c

index 5d540a7d407da1be3babba109f7fdf210f08db6b..20a0193ef1702a878aae81ff7750fa994315232e 100644 (file)
@@ -67,9 +67,12 @@ void journal_file_close(JournalFile *f) {
 
         assert(f);
 
-        if (f->header && f->writable)
-                f->header->state = STATE_OFFLINE;
+        if (f->header) {
+                if (f->writable)
+                        f->header->state = STATE_OFFLINE;
 
+                munmap(f->header, PAGE_ALIGN(sizeof(Header)));
+        }
 
         for (t = 0; t < _WINDOW_MAX; t++)
                 if (f->windows[t].ptr)