keeper: fix memory leak in case of compression is used (default)

In case of compression is used, ZstdDeflatingAppendableWriteBuffer is
used, but it has a leak, since it frees ZSTD_CCtx only if there was
write while this is not correct, since it is created anyway.

This was found with jemalloc profile, keeper-bench and the following
keeper settings:

- force_sync=false
- snapshot_distance=100
- reserved_log_items=0
- rotate_log_storage_interval=100

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2022-01-20 18:51:51 +03:00
parent 9f6f84259d
commit d021190b8c

View File

@ -84,6 +84,8 @@ void ZstdDeflatingAppendableWriteBuffer::finalizeImpl()
{
if (first_write)
{
/// To free cctx
finalizeAfter();
/// Nothing was written
return;
}