diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h
index a0c16f062d..e0c073d153 100644
--- a/src/client/inc/tscUtil.h
+++ b/src/client/inc/tscUtil.h
@@ -106,6 +106,8 @@ void tscAddSpecialColumnForSelect(SSqlCmd* pCmd, int32_t outputColIndex, int16_t
SSchema* pColSchema, int16_t isTag);
void addRequiredTagColumn(SSqlCmd* pCmd, int32_t tagColIndex, int32_t tableIndex);
+
+//TODO refactor, remove
void SStringFree(SString* str);
void SStringCopy(SString* pDest, const SString* pSrc);
SString SStringCreate(const char* str);
diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c
index d217d09588..a18a98c8c1 100644
--- a/src/client/src/tscLocal.c
+++ b/src/client/src/tscLocal.c
@@ -26,7 +26,7 @@
#include "tschemautil.h"
#include "tsocket.h"
-static int32_t getToStringLength(char *pData, int32_t length, int32_t type) {
+static int32_t getToStringLength(const char *pData, int32_t length, int32_t type) {
char buf[512] = {0};
int32_t len = 0;
diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c
index fd23b183b1..25564a75ea 100644
--- a/src/client/src/tscUtil.c
+++ b/src/client/src/tscUtil.c
@@ -1643,7 +1643,7 @@ int32_t SStringEnsureRemain(SString* pStr, int32_t size) {
}
// remain space is insufficient, allocate more spaces
- int32_t inc = (size < MIN_ALLOC_SIZE) ? size : MIN_ALLOC_SIZE;
+ int32_t inc = (size >= MIN_ALLOC_SIZE) ? size : MIN_ALLOC_SIZE;
if (inc < (pStr->alloc >> 1)) {
inc = (pStr->alloc >> 1);
}
@@ -1670,6 +1670,7 @@ int32_t SStringEnsureRemain(SString* pStr, int32_t size) {
}
memset(tmp + pStr->n, 0, inc);
+ pStr->alloc = newsize;
pStr->z = tmp;
return TSDB_CODE_SUCCESS;
diff --git a/src/util/src/tnote.c b/src/util/src/tnote.c
index 68228d377a..709ac2742e 100644
--- a/src/util/src/tnote.c
+++ b/src/util/src/tnote.c
@@ -13,22 +13,6 @@
* along with this program. If not, see .
*/
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
#include "os.h"
#include "tutil.h"
#include "tglobalcfg.h"