From 198be9a7a6da370396bb4044ed5640e1e13080dd Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 15 May 2023 10:13:20 +0800 Subject: [PATCH] fix: double decompress issue and memory leak issue --- source/client/src/clientHb.c | 3 ++- source/libs/catalog/src/ctgUtil.c | 2 ++ source/util/src/tcompression.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 65e4030cbe..0cf9930911 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -97,7 +97,8 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog SDbHbBatchRsp batchRsp = {0}; if (tDeserializeSDbHbBatchRsp(value, valueLen, &batchRsp) != 0) { terrno = TSDB_CODE_INVALID_MSG; - return -1; + code = terrno; + goto _return; } int32_t numOfBatchs = taosArrayGetSize(batchRsp.pArray); diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index bf858c7b44..ae8fe0cca4 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -236,6 +236,7 @@ void ctgFreeTbCache(SCtgDBCache* dbCache) { } void ctgFreeVgInfoCache(SCtgDBCache* dbCache) { freeVgInfo(dbCache->vgCache.vgInfo); } +void ctgFreeCfgInfoCache(SCtgDBCache* dbCache) { freeDbCfgInfo(dbCache->cfgCache.cfgInfo); } void ctgFreeDbCache(SCtgDBCache* dbCache) { if (NULL == dbCache) { @@ -243,6 +244,7 @@ void ctgFreeDbCache(SCtgDBCache* dbCache) { } ctgFreeVgInfoCache(dbCache); + ctgFreeCfgInfoCache(dbCache); ctgFreeStbMetaCache(dbCache); ctgFreeTbCache(dbCache); } diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c index 38d5a9edeb..b05f1808e8 100644 --- a/source/util/src/tcompression.c +++ b/source/util/src/tcompression.c @@ -916,7 +916,7 @@ FORCE_INLINE uint64_t decodeDoubleValue(const char *const input, int32_t *const uint64_t diff = 0ul; int32_t nbytes = (flag & 0x7) + 1; for (int32_t i = 0; i < nbytes; i++) { - diff |= (((uint64_t)0xffff & input[(*ipos)++]) << BITS_PER_BYTE * i); + diff |= (((uint64_t)0xff & input[(*ipos)++]) << BITS_PER_BYTE * i); } int32_t shift_width = (LONG_BYTES * BITS_PER_BYTE - nbytes * BITS_PER_BYTE) * (flag >> 3); diff <<= shift_width;