From 2da8645d36fde33ef7e5ff153b4fe59fe7c53d1a Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 17 Apr 2024 10:22:54 +0800 Subject: [PATCH] add compress --- source/libs/stream/src/streamBackendRocksdb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index 9a79bf7185..02dba50d84 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -1553,8 +1553,9 @@ void destroyCompare(void* arg) { int32_t valueEncode(void* value, int32_t vlen, int64_t ttl, char** dest) { SStreamValue key = {.unixTimestamp = ttl, .len = vlen, .rawLen = vlen, .compress = 0, .data = (char*)(value)}; int32_t len = 0; + char* dst = NULL; if (vlen > 512) { - char* dst = taosMemoryCalloc(1, vlen + 128); + dst = taosMemoryCalloc(1, vlen + 128); int32_t dstCap = vlen + 128; int32_t compressedSize = LZ4_compress_default((char*)value, dst, vlen, dstCap); if (compressedSize < vlen) { @@ -1583,6 +1584,7 @@ int32_t valueEncode(void* value, int32_t vlen, int64_t ttl, char** dest) { len += taosEncodeFixedI8((void**)&buf, key.compress); len += taosEncodeBinary((void**)&buf, (char*)value, key.len); } + taosMemoryFree(dst); return len; }