]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-journal: add forgotten unmap in error path
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 11 Feb 2021 08:35:52 +0000 (09:35 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 11 Feb 2021 08:35:52 +0000 (09:35 +0100)
Bug introduced in 4b5bc5396c090ee41c45cab9052372d296c4a2f4 :(

Coverity CID#1444709.

src/libsystemd/sd-journal/compress.c

index aaf186ba69f4a64baf37db144b2eb1f773e0859b..429dbadb6c946453b2d9df82ca1b0005c0f62c0b 100644 (file)
@@ -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);