From: Daan De Meyer Date: Wed, 20 Apr 2022 17:52:13 +0000 (+0200) Subject: journal: Only move to object if requested X-Git-Tag: v251-rc2~25^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4d8b09e4b85611e5c5b44bee328084f825ba3a9c;p=thirdparty%2Fsystemd.git journal: Only move to object if requested --- diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c index e8c66a5e2cc..29e11c0d536 100644 --- a/src/libsystemd/sd-journal/sd-journal.c +++ b/src/libsystemd/sd-journal/sd-journal.c @@ -493,7 +493,6 @@ static int next_for_match( int r; uint64_t np = 0; - Object *n; assert(j); assert(m); @@ -569,12 +568,12 @@ static int next_for_match( assert(np > 0); - r = journal_file_move_to_object(f, OBJECT_ENTRY, np, &n); - if (r < 0) - return r; + if (ret) { + r = journal_file_move_to_object(f, OBJECT_ENTRY, np, ret); + if (r < 0) + return r; + } - if (ret) - *ret = n; if (offset) *offset = np; @@ -633,7 +632,6 @@ static int find_location_for_match( } else if (m->type == MATCH_OR_TERM) { uint64_t np = 0; - Object *n; /* Find the earliest match */ @@ -652,12 +650,12 @@ static int find_location_for_match( if (np == 0) return 0; - r = journal_file_move_to_object(f, OBJECT_ENTRY, np, &n); - if (r < 0) - return r; + if (ret) { + r = journal_file_move_to_object(f, OBJECT_ENTRY, np, ret); + if (r < 0) + return r; + } - if (ret) - *ret = n; if (offset) *offset = np;