Skip to content

Commit 0bd94dd

Browse files
committed
in_systemd: always reset cursor before iterating fields
Signed-off-by: Eduardo Silva <[email protected]>
1 parent 6345fd1 commit 0bd94dd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

plugins/in_systemd/systemd.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,16 @@ static int in_systemd_collect(struct flb_input_instance *ins,
384384
/* Pack every field in the entry */
385385
entries = 0;
386386
skip_entries = 0;
387+
388+
/*
389+
* Restart the journal data cursor before enumerating the fields for
390+
* this entry. Recent libsystemd releases require callers to reset
391+
* the cursor between entries; otherwise the internal decompression
392+
* context can be reused in an invalid state, which ultimately
393+
* triggers a crash in ZSTD_freeDDict().
394+
*/
395+
sd_journal_restart_data(ctx->j);
396+
387397
while (sd_journal_enumerate_data(ctx->j, &data, &length) > 0 &&
388398
entries < ctx->max_fields) {
389399
key = (const char *) data;

0 commit comments

Comments
 (0)