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;