From: Zbigniew Jędrzejewski-Szmek Date: Thu, 11 Feb 2021 08:35:52 +0000 (+0100) Subject: sd-journal: add forgotten unmap in error path X-Git-Tag: v248-rc1~154^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=363729c4704b9838f351eaba3acb8b1ed16fae0e;p=thirdparty%2Fsystemd.git sd-journal: add forgotten unmap in error path Bug introduced in 4b5bc5396c090ee41c45cab9052372d296c4a2f4 :( Coverity CID#1444709. --- diff --git a/src/libsystemd/sd-journal/compress.c b/src/libsystemd/sd-journal/compress.c index aaf186ba69f..429dbadb6c9 100644 --- a/src/libsystemd/sd-journal/compress.c +++ b/src/libsystemd/sd-journal/compress.c @@ -664,10 +664,11 @@ int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes) { offset += n; total_out += n; - if (max_bytes != (uint64_t) -1 && total_out > (size_t) max_bytes) - return log_debug_errno(SYNTHETIC_ERRNO(EFBIG), - "Compressed stream longer than %" PRIu64 " bytes", - max_bytes); + if (max_bytes != (uint64_t) -1 && total_out > (size_t) max_bytes) { + r = log_debug_errno(SYNTHETIC_ERRNO(EFBIG), + "Compressed stream longer than %" PRIu64 " bytes", max_bytes); + goto cleanup; + } if (size - offset < frame_size + 4) { k = loop_write(fdt, buf, offset, false);