chiark / gitweb /
journal-file: fix mmap leak
authorMichal Schmidt <mschmidt@redhat.com>
Tue, 12 Jun 2012 14:45:09 +0000 (16:45 +0200)
committerMichal Schmidt <mschmidt@redhat.com>
Tue, 12 Jun 2012 14:46:34 +0000 (16:46 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=831132

src/journal/journal-file.c

index 5dd6e57..1f82191 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)