Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9c4cebb1
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
9c4cebb1
编写于
1月 04, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:memory leak
上级
d3fe415b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
33 addition
and
2 deletion
+33
-2
source/client/inc/clientSml.h
source/client/inc/clientSml.h
+1
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+10
-0
source/client/src/clientSmlJson.c
source/client/src/clientSmlJson.c
+2
-0
source/client/src/clientSmlLine.c
source/client/src/clientSmlLine.c
+1
-0
source/client/src/clientSmlTelnet.c
source/client/src/clientSmlTelnet.c
+1
-0
source/libs/parser/src/parInsertSml.c
source/libs/parser/src/parInsertSml.c
+18
-2
未找到文件。
source/client/inc/clientSml.h
浏览文件 @
9c4cebb1
...
...
@@ -231,6 +231,7 @@ int64_t smlParseOpenTsdbTime(SSmlHandle *info, const char *data, int32
int32_t
smlClearForRerun
(
SSmlHandle
*
info
);
int32_t
smlParseValue
(
SSmlKv
*
pVal
,
SSmlMsgBuf
*
msg
);
uint8_t
smlGetTimestampLen
(
int64_t
num
);
void
clearColValArray
(
SArray
*
pCols
);
int32_t
smlParseInfluxString
(
SSmlHandle
*
info
,
char
*
sql
,
char
*
sqlEnd
,
SSmlLineInfo
*
elements
);
int32_t
smlParseTelnetString
(
SSmlHandle
*
info
,
char
*
sql
,
char
*
sqlEnd
,
SSmlLineInfo
*
elements
);
...
...
source/client/src/clientSml.c
浏览文件 @
9c4cebb1
...
...
@@ -1024,6 +1024,16 @@ static void smlDestroyTableInfo(SSmlHandle *info, SSmlTableInfo *tag) {
taosMemoryFree
(
tag
);
}
void
clearColValArray
(
SArray
*
pCols
)
{
int32_t
num
=
taosArrayGetSize
(
pCols
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SColVal
*
pCol
=
taosArrayGet
(
pCols
,
i
);
if
(
TSDB_DATA_TYPE_NCHAR
==
pCol
->
type
)
{
taosMemoryFreeClear
(
pCol
->
value
.
pData
);
}
}
}
void
smlDestroyInfo
(
SSmlHandle
*
info
)
{
if
(
!
info
)
return
;
qDestroyQuery
(
info
->
pQuery
);
...
...
source/client/src/clientSmlJson.c
浏览文件 @
9c4cebb1
...
...
@@ -995,6 +995,7 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo
if
(
ret
==
TSDB_CODE_SUCCESS
){
ret
=
smlBuildRow
(
info
->
currTableDataCtx
);
}
clearColValArray
(
info
->
currTableDataCtx
->
pValues
);
if
(
unlikely
(
ret
!=
TSDB_CODE_SUCCESS
))
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlBuildCol error"
,
NULL
);
return
ret
;
...
...
@@ -1147,6 +1148,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo *
if
(
ret
==
TSDB_CODE_SUCCESS
){
ret
=
smlBuildRow
(
info
->
currTableDataCtx
);
}
clearColValArray
(
info
->
currTableDataCtx
->
pValues
);
if
(
unlikely
(
ret
!=
TSDB_CODE_SUCCESS
))
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlBuildCol error"
,
NULL
);
return
ret
;
...
...
source/client/src/clientSmlLine.c
浏览文件 @
9c4cebb1
...
...
@@ -646,6 +646,7 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine
if
(
info
->
dataFormat
){
smlBuildCol
(
info
->
currTableDataCtx
,
info
->
currSTableMeta
->
schema
,
&
kv
,
0
);
smlBuildRow
(
info
->
currTableDataCtx
);
clearColValArray
(
info
->
currTableDataCtx
->
pValues
);
}
else
{
taosArraySet
(
elements
->
colArray
,
0
,
&
kv
);
}
...
...
source/client/src/clientSmlTelnet.c
浏览文件 @
9c4cebb1
...
...
@@ -324,6 +324,7 @@ int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine
if
(
ret
==
TSDB_CODE_SUCCESS
){
ret
=
smlBuildRow
(
info
->
currTableDataCtx
);
}
clearColValArray
(
info
->
currTableDataCtx
->
pValues
);
if
(
unlikely
(
ret
!=
TSDB_CODE_SUCCESS
))
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlBuildCol error"
,
NULL
);
return
ret
;
...
...
source/libs/parser/src/parInsertSml.c
浏览文件 @
9c4cebb1
...
...
@@ -18,6 +18,16 @@
#include "parToken.h"
#include "ttime.h"
static
void
clearColValArray
(
SArray
*
pCols
)
{
int32_t
num
=
taosArrayGetSize
(
pCols
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SColVal
*
pCol
=
taosArrayGet
(
pCols
,
i
);
if
(
TSDB_DATA_TYPE_NCHAR
==
pCol
->
type
)
{
taosMemoryFreeClear
(
pCol
->
value
.
pData
);
}
}
}
int32_t
qCreateSName
(
SName
*
pName
,
const
char
*
pTableName
,
int32_t
acctId
,
char
*
dbName
,
char
*
msgBuf
,
int32_t
msgBufLen
)
{
SMsgBuf
msg
=
{.
buf
=
msgBuf
,
.
len
=
msgBufLen
};
...
...
@@ -189,7 +199,7 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32
SSchema
*
pColSchema
=
schema
+
index
;
SColVal
*
pVal
=
taosArrayGet
(
pTableCxt
->
pValues
,
index
);
SSmlKv
*
kv
=
(
SSmlKv
*
)
data
;
if
(
kv
->
keyLen
!=
strlen
(
pColSchema
->
name
)
||
memcmp
(
kv
->
key
,
pColSchema
->
name
,
kv
->
keyLen
)
!=
0
){
if
(
kv
->
keyLen
!=
strlen
(
pColSchema
->
name
)
||
memcmp
(
kv
->
key
,
pColSchema
->
name
,
kv
->
keyLen
)
!=
0
||
kv
->
type
!=
pColSchema
->
type
){
ret
=
TSDB_CODE_SML_INVALID_DATA
;
goto
end
;
}
...
...
@@ -207,9 +217,11 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32
}
if
(
!
taosMbsToUcs4
(
kv
->
value
,
kv
->
length
,
(
TdUcs4
*
)
pUcs4
,
size
,
&
len
))
{
if
(
errno
==
E2BIG
)
{
taosMemoryFree
(
pUcs4
);
ret
=
TSDB_CODE_PAR_VALUE_TOO_LONG
;
goto
end
;
}
taosMemoryFree
(
pUcs4
);
ret
=
TSDB_CODE_TSC_INVALID_VALUE
;
goto
end
;
}
...
...
@@ -316,7 +328,10 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
continue
;
}
SSmlKv
*
kv
=
*
(
SSmlKv
**
)
p
;
if
(
kv
->
type
!=
pColSchema
->
type
){
ret
=
buildInvalidOperationMsg
(
&
pBuf
,
"kv type not equal to col type"
);
goto
end
;
}
if
(
pColSchema
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
kv
->
i
=
convertTimePrecision
(
kv
->
i
,
TSDB_TIME_PRECISION_NANO
,
pTableMeta
->
tableInfo
.
precision
);
}
...
...
@@ -354,6 +369,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
goto
end
;
}
insCheckTableDataOrder
(
pTableCxt
,
TD_ROW_KEY
(
*
pRow
));
clearColValArray
(
pTableCxt
->
pValues
);
}
end:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录