Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
752844b1
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
752844b1
编写于
10月 16, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1728] fix memory leaks
上级
b1cc403d
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
13 addition
and
17 deletion
+13
-17
src/client/inc/tscSubquery.h
src/client/inc/tscSubquery.h
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+12
-16
未找到文件。
src/client/inc/tscSubquery.h
浏览文件 @
752844b1
...
...
@@ -28,7 +28,7 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql);
void
tscSetupOutputColumnIndex
(
SSqlObj
*
pSql
);
void
tscJoinQueryCallback
(
void
*
param
,
TAOS_RES
*
tres
,
int
code
);
SJoinSupporter
*
tscCreateJoinSupporter
(
SSqlObj
*
pSql
,
SSubqueryState
*
pState
,
int32_t
index
);
SJoinSupporter
*
tscCreateJoinSupporter
(
SSqlObj
*
pSql
,
int32_t
index
);
void
tscHandleMasterJoinQuery
(
SSqlObj
*
pSql
);
...
...
src/client/src/tscSubquery.c
浏览文件 @
752844b1
...
...
@@ -166,7 +166,7 @@ static int64_t doTSBlockIntersect(SSqlObj* pSql, SJoinSupporter* pSupporter1, SJ
}
// todo handle failed to create sub query
SJoinSupporter
*
tscCreateJoinSupporter
(
SSqlObj
*
pSql
,
SSubqueryState
*
pState
,
int32_t
index
)
{
SJoinSupporter
*
tscCreateJoinSupporter
(
SSqlObj
*
pSql
,
int32_t
index
)
{
SJoinSupporter
*
pSupporter
=
calloc
(
1
,
sizeof
(
SJoinSupporter
));
if
(
pSupporter
==
NULL
)
{
return
NULL
;
...
...
@@ -1300,11 +1300,11 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) {
int32_t
code
=
TSDB_CODE_SUCCESS
;
// todo add test
SSubqueryState
*
pState
=
calloc
(
1
,
sizeof
(
SSubqueryState
));
if
(
pState
==
NULL
)
{
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
goto
_error
;
}
//
SSubqueryState *pState = calloc(1, sizeof(SSubqueryState));
//
if (pState == NULL) {
//
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
//
goto _error;
//
}
pSql
->
subState
.
numOfSub
=
pQueryInfo
->
numOfTables
;
...
...
@@ -1312,7 +1312,7 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) {
tscDebug
(
"%p start subquery, total:%d"
,
pSql
,
pQueryInfo
->
numOfTables
);
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
SJoinSupporter
*
pSupporter
=
tscCreateJoinSupporter
(
pSql
,
pState
,
i
);
SJoinSupporter
*
pSupporter
=
tscCreateJoinSupporter
(
pSql
,
i
);
if
(
pSupporter
==
NULL
)
{
// failed to create support struct, abort current query
tscError
(
"%p tableIndex:%d, failed to allocate join support object, abort further query"
,
pSql
,
i
);
...
...
@@ -1357,8 +1357,8 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) {
tscQueueAsyncRes
(
pSql
);
}
static
void
doCleanupSubqueries
(
SSqlObj
*
pSql
,
int32_t
numOfSubs
,
SSubqueryState
*
pState
)
{
assert
(
numOfSubs
<=
pSql
->
subState
.
numOfSub
&&
numOfSubs
>=
0
&&
pState
!=
NULL
);
static
void
doCleanupSubqueries
(
SSqlObj
*
pSql
,
int32_t
numOfSubs
)
{
assert
(
numOfSubs
<=
pSql
->
subState
.
numOfSub
&&
numOfSubs
>=
0
);
for
(
int32_t
i
=
0
;
i
<
numOfSubs
;
++
i
)
{
SSqlObj
*
pSub
=
pSql
->
pSubs
[
i
];
...
...
@@ -1371,8 +1371,6 @@ static void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs, SSubqueryState
taos_free_result
(
pSub
);
}
free
(
pState
);
}
int32_t
tscHandleMasterSTableQuery
(
SSqlObj
*
pSql
)
{
...
...
@@ -1410,10 +1408,8 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
pSql
->
pSubs
=
calloc
(
pSql
->
subState
.
numOfSub
,
POINTER_BYTES
);
tscDebug
(
"%p retrieved query data from %d vnode(s)"
,
pSql
,
pSql
->
subState
.
numOfSub
);
SSubqueryState
*
pState
=
calloc
(
1
,
sizeof
(
SSubqueryState
));
if
(
pSql
->
pSubs
==
NULL
||
pState
==
NULL
)
{
taosTFree
(
pState
);
if
(
pSql
->
pSubs
==
NULL
)
{
taosTFree
(
pSql
->
pSubs
);
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tscLocalReducerEnvDestroy
(
pMemoryBuf
,
pDesc
,
pModel
,
pSql
->
subState
.
numOfSub
);
...
...
@@ -1470,13 +1466,13 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tscLocalReducerEnvDestroy
(
pMemoryBuf
,
pDesc
,
pModel
,
pSql
->
subState
.
numOfSub
);
doCleanupSubqueries
(
pSql
,
i
,
pState
);
doCleanupSubqueries
(
pSql
,
i
);
return
pRes
->
code
;
// free all allocated resource
}
if
(
pRes
->
code
==
TSDB_CODE_TSC_QUERY_CANCELLED
)
{
tscLocalReducerEnvDestroy
(
pMemoryBuf
,
pDesc
,
pModel
,
pSql
->
subState
.
numOfSub
);
doCleanupSubqueries
(
pSql
,
i
,
pState
);
doCleanupSubqueries
(
pSql
,
i
);
return
pRes
->
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录