diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c index 7527abf636c..78f7f226c89 100644 --- a/src/libsystemd/sd-journal/catalog.c +++ b/src/libsystemd/sd-journal/catalog.c @@ -145,7 +145,8 @@ static int finish_item( char *payload, size_t payload_size) { _cleanup_free_ CatalogItem *i = NULL; - _cleanup_free_ char *prev = NULL, *combined = NULL; + _cleanup_free_ char *combined = NULL; + char *prev; assert(h); assert(payload); @@ -171,6 +172,7 @@ static int finish_item( if (ordered_hashmap_update(h, i, combined) < 0) return log_oom(); combined = NULL; + free(prev); } else { /* A new item */ combined = memdup(payload, payload_size + 1);