Skip to content

Commit 636e19c

Browse files
committed
Avoid a double-free on the extra drainJournal call
The drainJournal() function frees a passed-in cursor and returns a new one. The final call we made to drainJournal() in followJournal() mistakenly discarded the updated cursor value, which would likely produce a double-free error. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
1 parent baa9bbf commit 636e19c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

daemon/logger/journald/read.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ func (s *journald) followJournal(logWatcher *logger.LogWatcher, config logger.Re
264264
// exited. Try to drain the journal one more time to pick up any last-minute journal entries.
265265
// Note, this isn't fool-proof and there's no guarantee that we'll get all the trailing
266266
// entries, but this is better than nothing, as it does yield entries more often than not.
267-
s.drainJournal(logWatcher, config, j, cursor)
267+
cursor = s.drainJournal(logWatcher, config, j, cursor)
268268
}
269269
// Clean up.
270270
C.close(pfd[0])

0 commit comments

Comments
 (0)