sd-journal: skip full decompression when caller only checks field existence

When both ret_data and ret_size are NULL after decompress_startswith()
has confirmed the field matches, skip the decompress_blob() call.
This avoids decompressing potentially large payloads (e.g. inline
coredumps) just to discard the result.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
noxiouz
2026-04-08 16:33:20 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent 329233dcbf
commit a5c811591f
+4
View File
@@ -1965,6 +1965,10 @@ static int maybe_decompress_payload(
*ret_size = 0;
return 0;
}
/* Caller only wants to check field existence, skip full decompression */
if (!ret_data && !ret_size)
return 1;
}
r = decompress_blob(compression, payload, size, &f->compress_buffer, &rsize, 0);