Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
98a2d311
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
98a2d311
编写于
5月 14, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor:fix memory leak
上级
d6478273
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
27 addition
and
11 deletion
+27
-11
source/client/src/clientSml.c
source/client/src/clientSml.c
+10
-4
source/client/test/smlTest.cpp
source/client/test/smlTest.cpp
+11
-4
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+3
-0
source/libs/parser/src/parInsertData.c
source/libs/parser/src/parInsertData.c
+3
-3
未找到文件。
source/client/src/clientSml.c
浏览文件 @
98a2d311
...
...
@@ -885,7 +885,7 @@ static int32_t smlParseInfluxString(const char* sql, SSmlLineInfo *elements, SSm
// parse measure
while
(
*
sql
!=
'\0'
)
{
if
(
IS_SLASH_LETTER
(
sql
)){
if
(
(
sql
!=
elements
->
measure
)
&&
IS_SLASH_LETTER
(
sql
)){
MOVE_FORWARD_ONE
(
sql
,
strlen
(
sql
)
+
1
);
continue
;
}
...
...
@@ -973,6 +973,8 @@ static int32_t smlParseTelnetTags(const char* data, SArray *cols, SHashObj *dump
const
char
*
sql
=
data
;
while
(
*
sql
!=
'\0'
){
JUMP_SPACE
(
sql
)
if
(
*
sql
==
'\0'
)
break
;
const
char
*
key
=
sql
;
int32_t
keyLen
=
0
;
...
...
@@ -1005,6 +1007,8 @@ static int32_t smlParseTelnetTags(const char* data, SArray *cols, SHashObj *dump
while
(
*
sql
!=
'\0'
)
{
// parse value
if
(
*
sql
==
SPACE
)
{
valueLen
=
sql
-
value
;
sql
++
;
break
;
}
if
(
*
sql
==
EQUAL
)
{
...
...
@@ -1013,14 +1017,15 @@ static int32_t smlParseTelnetTags(const char* data, SArray *cols, SHashObj *dump
}
sql
++
;
}
valueLen
=
sql
-
value
;
sql
++
;
JUMP_SPACE
(
sql
)
if
(
valueLen
==
0
){
valueLen
=
sql
-
value
;
}
if
(
valueLen
==
0
){
smlBuildInvalidDataMsg
(
msg
,
"invalid value"
,
value
);
return
TSDB_CODE_SML_INVALID_DATA
;
}
// add kv to SSmlKv
SSmlKv
*
kv
=
(
SSmlKv
*
)
taosMemoryCalloc
(
sizeof
(
SSmlKv
),
1
);
if
(
!
kv
)
return
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -1354,6 +1359,7 @@ static void smlDestroySTableMeta(SSmlSTableMeta *meta){
taosArrayDestroy
(
meta
->
tags
);
taosArrayDestroy
(
meta
->
cols
);
taosMemoryFree
(
meta
->
tableMeta
);
taosMemoryFree
(
meta
);
}
static
void
smlDestroyCols
(
SArray
*
cols
)
{
...
...
source/client/test/smlTest.cpp
浏览文件 @
98a2d311
...
...
@@ -206,10 +206,16 @@ TEST(testCase, smlParseCols_Error_Test) {
int32_t
len
=
strlen
(
data
[
i
]);
char
*
sql
=
(
char
*
)
taosMemoryCalloc
(
256
,
1
);
memcpy
(
sql
,
data
[
i
],
len
+
1
);
int32_t
ret
=
smlParseCols
(
sql
,
len
,
NULL
,
false
,
dumplicateKey
,
&
msgBuf
);
SArray
*
cols
=
taosArrayInit
(
8
,
POINTER_BYTES
);
int32_t
ret
=
smlParseCols
(
sql
,
len
,
cols
,
false
,
dumplicateKey
,
&
msgBuf
);
ASSERT_NE
(
ret
,
TSDB_CODE_SUCCESS
);
taosHashClear
(
dumplicateKey
);
taosMemoryFree
(
sql
);
for
(
int
j
=
0
;
j
<
taosArrayGetSize
(
cols
);
j
++
){
void
*
kv
=
taosArrayGetP
(
cols
,
j
);
taosMemoryFree
(
kv
);
}
taosArrayDestroy
(
cols
);
}
taosHashCleanup
(
dumplicateKey
);
}
...
...
@@ -239,7 +245,6 @@ TEST(testCase, smlParseCols_tag_Test) {
ASSERT_EQ
(
kv
->
type
,
TSDB_DATA_TYPE_NCHAR
);
ASSERT_EQ
(
kv
->
length
,
15
);
ASSERT_EQ
(
strncasecmp
(
kv
->
value
,
"
\"
passit"
,
7
),
0
);
taosMemoryFree
(
kv
);
// nchar
kv
=
(
SSmlKv
*
)
taosArrayGetP
(
cols
,
3
);
...
...
@@ -248,11 +253,13 @@ TEST(testCase, smlParseCols_tag_Test) {
ASSERT_EQ
(
kv
->
type
,
TSDB_DATA_TYPE_NCHAR
);
ASSERT_EQ
(
kv
->
length
,
7
);
ASSERT_EQ
(
strncasecmp
(
kv
->
value
,
"4.31f64"
,
7
),
0
);
taosMemoryFree
(
kv
);
for
(
int
i
=
0
;
i
<
size
;
i
++
){
void
*
tmp
=
taosArrayGetP
(
cols
,
i
);
taosMemoryFree
(
tmp
);
}
taosArrayClear
(
cols
);
// test tag is null
data
=
"t=3e"
;
len
=
0
;
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
98a2d311
...
...
@@ -1826,6 +1826,9 @@ void smlDestroyHandle(void* pHandle) {
if
(
!
pHandle
)
return
;
SSmlExecHandle
*
handle
=
(
SSmlExecHandle
*
)
pHandle
;
destroyBlockHashmap
(
handle
->
pBlockHash
);
tdDestroyKVRowBuilder
(
&
handle
->
tagsBuilder
);
destroyBoundColumnInfo
(
&
handle
->
tags
);
destroyCreateSubTbReq
(
&
handle
->
createTblReq
);
taosMemoryFree
(
handle
);
}
...
...
source/libs/parser/src/parInsertData.c
浏览文件 @
98a2d311
...
...
@@ -237,9 +237,9 @@ static void destroyDataBlock(STableDataBlocks* pDataBlock) {
taosMemoryFreeClear
(
pDataBlock
->
pData
);
if
(
!
pDataBlock
->
cloned
)
{
// free the refcount for metermeta
//
if (pDataBlock->pTableMeta != NULL) {
//
taosMemoryFreeClear(pDataBlock->pTableMeta);
//
}
if
(
pDataBlock
->
pTableMeta
!=
NULL
)
{
taosMemoryFreeClear
(
pDataBlock
->
pTableMeta
);
}
destroyBoundColumnInfo
(
&
pDataBlock
->
boundColumnInfo
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录