Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
14440544
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
14440544
编写于
7月 18, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix stmt memory leak
上级
4a54ce26
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
24 addition
and
16 deletion
+24
-16
source/client/src/clientStmt.c
source/client/src/clientStmt.c
+9
-4
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+2
-6
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+3
-1
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+6
-0
tests/script/api/batchprepare.c
tests/script/api/batchprepare.c
+4
-5
未找到文件。
source/client/src/clientStmt.c
浏览文件 @
14440544
...
...
@@ -6,11 +6,16 @@
#include "clientStmt.h"
static
int32_t
stmtCreateRequest
(
STscStmt
*
pStmt
)
{
int32_t
code
=
0
;
if
(
pStmt
->
exec
.
pRequest
==
NULL
)
{
return
buildRequest
(
pStmt
->
taos
->
id
,
pStmt
->
sql
.
sqlStr
,
pStmt
->
sql
.
sqlLen
,
NULL
,
false
,
&
pStmt
->
exec
.
pRequest
);
}
else
{
return
TSDB_CODE_SUCCESS
;
code
=
buildRequest
(
pStmt
->
taos
->
id
,
pStmt
->
sql
.
sqlStr
,
pStmt
->
sql
.
sqlLen
,
NULL
,
false
,
&
pStmt
->
exec
.
pRequest
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pStmt
->
exec
.
pRequest
->
syncQuery
=
true
;
}
}
return
code
;
}
int32_t
stmtSwitchStatus
(
STscStmt
*
pStmt
,
STMT_STATUS
newStatus
)
{
...
...
@@ -227,7 +232,7 @@ int32_t stmtParseSql(STscStmt* pStmt) {
};
STMT_ERR_RET
(
stmtCreateRequest
(
pStmt
));
STMT_ERR_RET
(
parseSql
(
pStmt
->
exec
.
pRequest
,
false
,
&
pStmt
->
sql
.
pQuery
,
&
stmtCb
));
pStmt
->
bInfo
.
needParse
=
false
;
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
14440544
...
...
@@ -388,11 +388,6 @@ static void destroyDataSinkNode(SDataSinkNode* pNode) { nodesDestroyNode((SNode*
static
void
destroyExprNode
(
SExprNode
*
pExpr
)
{
taosArrayDestroy
(
pExpr
->
pAssociation
);
}
static
void
nodesDestroyNodePointer
(
void
*
node
)
{
SNode
*
pNode
=
*
(
SNode
**
)
node
;
nodesDestroyNode
(
pNode
);
}
void
nodesDestroyNode
(
SNode
*
pNode
)
{
if
(
NULL
==
pNode
)
{
return
;
...
...
@@ -716,6 +711,7 @@ void nodesDestroyNode(SNode* pNode) {
case
QUERY_NODE_QUERY
:
{
SQuery
*
pQuery
=
(
SQuery
*
)
pNode
;
nodesDestroyNode
(
pQuery
->
pRoot
);
nodesDestroyNode
(
pQuery
->
pPrepareRoot
);
taosMemoryFreeClear
(
pQuery
->
pResSchema
);
if
(
NULL
!=
pQuery
->
pCmdMsg
)
{
taosMemoryFreeClear
(
pQuery
->
pCmdMsg
->
pMsg
);
...
...
@@ -723,7 +719,7 @@ void nodesDestroyNode(SNode* pNode) {
}
taosArrayDestroy
(
pQuery
->
pDbList
);
taosArrayDestroy
(
pQuery
->
pTableList
);
taosArrayDestroy
Ex
(
pQuery
->
pPlaceholderValues
,
nodesDestroyNodePointer
);
taosArrayDestroy
(
pQuery
->
pPlaceholderValues
);
break
;
}
case
QUERY_NODE_LOGIC_PLAN_SCAN
:
{
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
14440544
...
...
@@ -1497,7 +1497,6 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
memset
(
&
pCxt
->
tags
,
0
,
sizeof
(
pCxt
->
tags
));
pCxt
->
pVgroupsHashObj
=
NULL
;
pCxt
->
pTableBlockHashObj
=
NULL
;
pCxt
->
pTableMeta
=
NULL
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1554,7 +1553,10 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery, SParseMetaCache
if
(
NULL
==
*
pQuery
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
else
{
nodesDestroyNode
((
*
pQuery
)
->
pRoot
);
}
(
*
pQuery
)
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
(
*
pQuery
)
->
haveResultSet
=
false
;
(
*
pQuery
)
->
msgType
=
TDMT_VND_SUBMIT
;
...
...
source/libs/parser/src/parser.c
浏览文件 @
14440544
...
...
@@ -82,11 +82,16 @@ static int32_t parseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, SParseMetaCa
}
static
int32_t
setValueByBindParam
(
SValueNode
*
pVal
,
TAOS_MULTI_BIND
*
pParam
)
{
if
(
IS_VAR_DATA_TYPE
(
pVal
->
node
.
resType
.
type
))
{
taosMemoryFreeClear
(
pVal
->
datum
.
p
);
}
if
(
pParam
->
is_null
&&
1
==
*
(
pParam
->
is_null
))
{
pVal
->
node
.
resType
.
type
=
TSDB_DATA_TYPE_NULL
;
pVal
->
node
.
resType
.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_NULL
].
bytes
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
inputSize
=
(
NULL
!=
pParam
->
length
?
*
(
pParam
->
length
)
:
tDataTypes
[
pParam
->
buffer_type
].
bytes
);
pVal
->
node
.
resType
.
type
=
pParam
->
buffer_type
;
pVal
->
node
.
resType
.
bytes
=
inputSize
;
...
...
@@ -239,6 +244,7 @@ int32_t qStmtBindParams(SQuery* pQuery, TAOS_MULTI_BIND* pParams, int32_t colIdx
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
(
colIdx
<
0
||
colIdx
+
1
==
pQuery
->
placeholderNum
))
{
nodesDestroyNode
(
pQuery
->
pRoot
);
pQuery
->
pRoot
=
nodesCloneNode
(
pQuery
->
pPrepareRoot
);
if
(
NULL
==
pQuery
->
pRoot
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
tests/script/api/batchprepare.c
浏览文件 @
14440544
...
...
@@ -218,7 +218,7 @@ typedef struct {
}
CaseCtrl
;
#if 0
CaseCtrl gCaseCtrl = {
// default
CaseCtrl gCaseCtrl = {
.precision = TIME_PRECISION_MICRO,
.bindNullNum = 0,
.printCreateTblSql = false,
...
...
@@ -251,7 +251,7 @@ CaseCtrl gCaseCtrl = { // default
#if 1
CaseCtrl
gCaseCtrl
=
{
CaseCtrl
gCaseCtrl
=
{
// default
.
precision
=
TIME_PRECISION_MILLI
,
.
bindNullNum
=
0
,
.
printCreateTblSql
=
false
,
...
...
@@ -2596,6 +2596,8 @@ void runAll(TAOS *taos) {
printf
(
"%s Begin
\n
"
,
gCaseCtrl
.
caseCatalog
);
runCaseList
(
taos
);
#if 0
strcpy(gCaseCtrl.caseCatalog, "Micro DB precision Test");
printf("%s Begin\n", gCaseCtrl.caseCatalog);
gCaseCtrl.precision = TIME_PRECISION_MICRO;
...
...
@@ -2626,7 +2628,6 @@ void runAll(TAOS *taos) {
runCaseList(taos);
gCaseCtrl.bindRowNum = 0;
#if 0
strcpy(gCaseCtrl.caseCatalog, "Row Num Test");
printf("%s Begin\n", gCaseCtrl.caseCatalog);
gCaseCtrl.rowNum = 1000;
...
...
@@ -2640,7 +2641,6 @@ void runAll(TAOS *taos) {
gCaseCtrl.runTimes = 2;
runCaseList(taos);
gCaseCtrl.runTimes = 0;
#endif
strcpy(gCaseCtrl.caseCatalog, "Check Param Test");
printf("%s Begin\n", gCaseCtrl.caseCatalog);
...
...
@@ -2648,7 +2648,6 @@ void runAll(TAOS *taos) {
runCaseList(taos);
gCaseCtrl.checkParamNum = false;
#if 0
strcpy(gCaseCtrl.caseCatalog, "Bind Col Num Test");
printf("%s Begin\n", gCaseCtrl.caseCatalog);
gCaseCtrl.bindColNum = 6;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录