Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
040e4354
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看板
提交
040e4354
编写于
1月 05, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add more free
上级
ce27353c
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
88 addition
and
88 deletion
+88
-88
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+10
-10
src/common/src/tvariant.c
src/common/src/tvariant.c
+14
-14
src/util/src/hash.c
src/util/src/hash.c
+3
-3
src/util/src/talgo.c
src/util/src/talgo.c
+1
-1
src/util/src/tarray.c
src/util/src/tarray.c
+3
-3
src/util/src/tcache.c
src/util/src/tcache.c
+9
-9
src/util/src/tcompare.c
src/util/src/tcompare.c
+1
-1
src/util/src/tconfig.c
src/util/src/tconfig.c
+2
-2
src/util/src/tdes.c
src/util/src/tdes.c
+1
-1
src/util/src/tidpool.c
src/util/src/tidpool.c
+4
-4
src/util/src/tkvstore.c
src/util/src/tkvstore.c
+6
-6
src/util/src/tlog.c
src/util/src/tlog.c
+2
-2
src/util/src/tmempool.c
src/util/src/tmempool.c
+6
-6
src/util/src/tnettest.c
src/util/src/tnettest.c
+1
-1
src/util/src/tqueue.c
src/util/src/tqueue.c
+5
-5
src/util/src/tref.c
src/util/src/tref.c
+6
-6
src/util/src/tsched.c
src/util/src/tsched.c
+3
-3
src/util/src/tskiplist.c
src/util/src/tskiplist.c
+4
-4
src/util/src/tstrbuild.c
src/util/src/tstrbuild.c
+1
-1
src/util/src/ttimer.c
src/util/src/ttimer.c
+5
-5
src/util/src/tworker.c
src/util/src/tworker.c
+1
-1
未找到文件。
src/common/src/tdataformat.c
浏览文件 @
040e4354
...
...
@@ -97,7 +97,7 @@ int tdInitTSchemaBuilder(STSchemaBuilder *pBuilder, int32_t version) {
void
tdDestroyTSchemaBuilder
(
STSchemaBuilder
*
pBuilder
)
{
if
(
pBuilder
)
{
tfree
(
pBuilder
->
columns
);
TDMFREE
(
pBuilder
->
columns
);
}
}
...
...
@@ -187,7 +187,7 @@ SDataRow tdNewDataRowFromSchema(STSchema *pSchema) {
* Free the SDataRow object
*/
void
tdFreeDataRow
(
SDataRow
row
)
{
if
(
row
)
free
(
row
);
if
(
row
)
TDMFREE
(
row
);
}
SDataRow
tdDataRowDup
(
SDataRow
row
)
{
...
...
@@ -339,9 +339,9 @@ int tdInitDataCols(SDataCols *pCols, STSchema *pSchema) {
void
tdFreeDataCols
(
SDataCols
*
pCols
)
{
if
(
pCols
)
{
tfree
(
pCols
->
buf
);
tfree
(
pCols
->
cols
);
free
(
pCols
);
TDMFREE
(
pCols
->
buf
);
TDMFREE
(
pCols
->
cols
);
TDMFREE
(
pCols
);
}
}
...
...
@@ -582,7 +582,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
}
*
orow
=
nrow
;
free
(
row
);
TDMFREE
(
row
);
}
else
{
ASSERT
(((
SColIdx
*
)
ptr
)
->
colId
==
colId
);
if
(
IS_VAR_DATA_TYPE
(
type
))
{
...
...
@@ -627,7 +627,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
}
*
orow
=
nrow
;
free
(
row
);
TDMFREE
(
row
);
}
}
else
{
memcpy
(
kvRowColVal
(
row
,
(
SColIdx
*
)
ptr
),
value
,
TYPE_BYTES
[
type
]);
...
...
@@ -662,15 +662,15 @@ int tdInitKVRowBuilder(SKVRowBuilder *pBuilder) {
pBuilder
->
size
=
0
;
pBuilder
->
buf
=
malloc
(
pBuilder
->
alloc
);
if
(
pBuilder
->
buf
==
NULL
)
{
free
(
pBuilder
->
pColIdx
);
TDMFREE
(
pBuilder
->
pColIdx
);
return
-
1
;
}
return
0
;
}
void
tdDestroyKVRowBuilder
(
SKVRowBuilder
*
pBuilder
)
{
tfree
(
pBuilder
->
pColIdx
);
tfree
(
pBuilder
->
buf
);
TDMFREE
(
pBuilder
->
pColIdx
);
TDMFREE
(
pBuilder
->
buf
);
}
void
tdResetKVRowBuilder
(
SKVRowBuilder
*
pBuilder
)
{
...
...
src/common/src/tvariant.c
浏览文件 @
040e4354
...
...
@@ -125,7 +125,7 @@ void tVariantDestroy(tVariant *pVar) {
if
(
pVar
==
NULL
)
return
;
if
(
pVar
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pVar
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
tfree
(
pVar
->
pz
);
TDMFREE
(
pVar
->
pz
);
pVar
->
nLen
=
0
;
}
...
...
@@ -134,7 +134,7 @@ void tVariantDestroy(tVariant *pVar) {
size_t
num
=
taosArrayGetSize
(
pVar
->
arr
);
for
(
size_t
i
=
0
;
i
<
num
;
i
++
)
{
void
*
p
=
taosArrayGetP
(
pVar
->
arr
,
i
);
free
(
p
);
TDMFREE
(
p
);
}
taosArrayDestroy
(
pVar
->
arr
);
pVar
->
arr
=
NULL
;
...
...
@@ -406,7 +406,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
}
taosUcs4ToMbs
(
pVariant
->
wpz
,
(
int32_t
)
newSize
,
pBuf
);
free
(
pVariant
->
wpz
);
TDMFREE
(
pVariant
->
wpz
);
pBuf
[
newSize
]
=
0
;
}
else
{
taosUcs4ToMbs
(
pVariant
->
wpz
,
(
int32_t
)
newSize
,
*
pDest
);
...
...
@@ -456,7 +456,7 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
// free the binary buffer in the first place
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_BINARY
)
{
free
(
pVariant
->
wpz
);
TDMFREE
(
pVariant
->
wpz
);
}
pVariant
->
wpz
=
pWStr
;
...
...
@@ -515,7 +515,7 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
if
(
token
.
type
==
TK_NULL
)
{
if
(
releaseVariantPtr
)
{
free
(
pVariant
->
pz
);
TDMFREE
(
pVariant
->
pz
);
pVariant
->
nLen
=
0
;
}
...
...
@@ -531,7 +531,7 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
if
(
token
.
type
==
TK_FLOAT
)
{
double
v
=
strtod
(
pVariant
->
pz
,
&
endPtr
);
if
(
releaseVariantPtr
)
{
free
(
pVariant
->
pz
);
TDMFREE
(
pVariant
->
pz
);
pVariant
->
nLen
=
0
;
}
...
...
@@ -543,7 +543,7 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
}
else
if
(
token
.
type
==
TK_INTEGER
)
{
int64_t
val
=
strtoll
(
pVariant
->
pz
,
&
endPtr
,
10
);
if
(
releaseVariantPtr
)
{
free
(
pVariant
->
pz
);
TDMFREE
(
pVariant
->
pz
);
pVariant
->
nLen
=
0
;
}
...
...
@@ -569,7 +569,7 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
if
(
token
.
type
==
TK_FLOAT
)
{
double
v
=
wcstod
(
pVariant
->
wpz
,
&
endPtr
);
if
(
releaseVariantPtr
)
{
free
(
pVariant
->
pz
);
TDMFREE
(
pVariant
->
pz
);
pVariant
->
nLen
=
0
;
}
...
...
@@ -580,7 +580,7 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
*
result
=
(
int64_t
)
v
;
}
else
if
(
token
.
type
==
TK_NULL
)
{
if
(
releaseVariantPtr
)
{
free
(
pVariant
->
pz
);
TDMFREE
(
pVariant
->
pz
);
pVariant
->
nLen
=
0
;
}
setNull
((
char
*
)
result
,
type
,
tDataTypeDesc
[
type
].
nSize
);
...
...
@@ -588,7 +588,7 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
}
else
{
int64_t
val
=
wcstoll
(
pVariant
->
wpz
,
&
endPtr
,
10
);
if
(
releaseVariantPtr
)
{
free
(
pVariant
->
pz
);
TDMFREE
(
pVariant
->
pz
);
pVariant
->
nLen
=
0
;
}
...
...
@@ -869,21 +869,21 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) {
errno
=
0
;
double
v
=
strtod
(
pVariant
->
pz
,
NULL
);
if
((
errno
==
ERANGE
&&
v
==
-
1
)
||
(
isinf
(
v
)
||
isnan
(
v
)))
{
free
(
pVariant
->
pz
);
TDMFREE
(
pVariant
->
pz
);
return
-
1
;
}
free
(
pVariant
->
pz
);
TDMFREE
(
pVariant
->
pz
);
pVariant
->
dKey
=
v
;
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
errno
=
0
;
double
v
=
wcstod
(
pVariant
->
wpz
,
NULL
);
if
((
errno
==
ERANGE
&&
v
==
-
1
)
||
(
isinf
(
v
)
||
isnan
(
v
)))
{
free
(
pVariant
->
pz
);
TDMFREE
(
pVariant
->
pz
);
return
-
1
;
}
free
(
pVariant
->
pz
);
TDMFREE
(
pVariant
->
pz
);
pVariant
->
dKey
=
v
;
}
else
if
(
pVariant
->
nType
>=
TSDB_DATA_TYPE_BOOL
&&
pVariant
->
nType
<=
TSDB_DATA_TYPE_BIGINT
)
{
pVariant
->
dKey
=
(
double
)(
pVariant
->
i64Key
);
...
...
src/util/src/hash.c
浏览文件 @
040e4354
...
...
@@ -22,7 +22,7 @@
#define DO_FREE_HASH_NODE(_n) \
do { \
tfree
(_n); \
TDMFREE
(_n); \
} while (0)
#define FREE_HASH_NODE(_h, _n) \
...
...
@@ -514,13 +514,13 @@ void taosHashCleanup(SHashObj *pHashObj) {
}
taosHashEmpty
(
pHashObj
);
tfree
(
pHashObj
->
hashList
);
TDMFREE
(
pHashObj
->
hashList
);
// destroy mem block
size_t
memBlock
=
taosArrayGetSize
(
pHashObj
->
pMemBlock
);
for
(
int32_t
i
=
0
;
i
<
memBlock
;
++
i
)
{
void
*
p
=
taosArrayGetP
(
pHashObj
->
pMemBlock
,
i
);
tfree
(
p
);
TDMFREE
(
p
);
}
taosArrayDestroy
(
pHashObj
->
pMemBlock
);
...
...
src/util/src/talgo.c
浏览文件 @
040e4354
...
...
@@ -153,7 +153,7 @@ static void tqsortImpl(void *src, int32_t start, int32_t end, size_t size, const
void
taosqsort
(
void
*
src
,
size_t
numOfElem
,
size_t
size
,
const
void
*
param
,
__ext_compar_fn_t
comparFn
)
{
char
*
buf
=
calloc
(
1
,
size
);
// prepare the swap buffer
tqsortImpl
(
src
,
0
,
(
int32_t
)
numOfElem
-
1
,
(
int32_t
)
size
,
param
,
comparFn
,
buf
);
tfree
(
buf
);
TDMFREE
(
buf
);
}
void
*
taosbsearch
(
const
void
*
key
,
const
void
*
base
,
size_t
nmemb
,
size_t
size
,
__compar_fn_t
compar
,
int
flags
)
{
...
...
src/util/src/tarray.c
浏览文件 @
040e4354
...
...
@@ -29,7 +29,7 @@ void* taosArrayInit(size_t size, size_t elemSize) {
pArray
->
pData
=
calloc
(
size
,
elemSize
);
if
(
pArray
->
pData
==
NULL
)
{
free
(
pArray
);
TDMFREE
(
pArray
);
return
NULL
;
}
...
...
@@ -189,8 +189,8 @@ void taosArrayDestroy(SArray* pArray) {
return
;
}
free
(
pArray
->
pData
);
free
(
pArray
);
TDMFREE
(
pArray
->
pData
);
TDMFREE
(
pArray
);
}
void
taosArrayDestroyEx
(
SArray
*
pArray
,
void
(
*
fp
)(
void
*
))
{
...
...
src/util/src/tcache.c
浏览文件 @
040e4354
...
...
@@ -104,7 +104,7 @@ static FORCE_INLINE void taosCacheReleaseNode(SCacheObj *pCacheObj, SCacheDataNo
pCacheObj
->
freeFp
(
pNode
->
data
);
}
free
(
pNode
);
TDMFREE
(
pNode
);
}
static
FORCE_INLINE
STrashElem
*
doRemoveElemInTrashcan
(
SCacheObj
*
pCacheObj
,
STrashElem
*
pElem
)
{
...
...
@@ -138,8 +138,8 @@ static FORCE_INLINE void doDestroyTrashcanElem(SCacheObj* pCacheObj, STrashElem
pCacheObj
->
freeFp
(
pElem
->
pData
->
data
);
}
free
(
pElem
->
pData
);
free
(
pElem
);
TDMFREE
(
pElem
->
pData
);
TDMFREE
(
pElem
);
}
/**
...
...
@@ -168,7 +168,7 @@ SCacheObj *taosCacheInit(int32_t keyType, int64_t refreshTimeInSeconds, bool ext
pCacheObj
->
pHashTable
=
taosHashInit
(
4096
,
taosGetDefaultHashFunction
(
keyType
),
false
,
HASH_ENTRY_LOCK
);
pCacheObj
->
name
=
strdup
(
cacheName
);
if
(
pCacheObj
->
pHashTable
==
NULL
)
{
free
(
pCacheObj
);
TDMFREE
(
pCacheObj
);
uError
(
"failed to allocate memory, reason:%s"
,
strerror
(
errno
));
return
NULL
;
}
...
...
@@ -180,7 +180,7 @@ SCacheObj *taosCacheInit(int32_t keyType, int64_t refreshTimeInSeconds, bool ext
if
(
__cache_lock_init
(
pCacheObj
)
!=
0
)
{
taosHashCleanup
(
pCacheObj
->
pHashTable
);
free
(
pCacheObj
);
TDMFREE
(
pCacheObj
);
uError
(
"failed to init lock, reason:%s"
,
strerror
(
errno
));
return
NULL
;
...
...
@@ -228,7 +228,7 @@ void *taosCachePut(SCacheObj *pCacheObj, const void *key, size_t keyLen, const v
pCacheObj
->
freeFp
(
p
->
data
);
}
tfree
(
p
);
TDMFREE
(
p
);
}
else
{
taosAddToTrashcan
(
pCacheObj
,
p
);
uDebug
(
"cache:%s, key:%p, %p exist in cache, updated old:%p"
,
pCacheObj
->
name
,
key
,
pNode1
->
data
,
p
->
data
);
...
...
@@ -436,7 +436,7 @@ void taosCacheRelease(SCacheObj *pCacheObj, void **data, bool _remove) {
pCacheObj
->
freeFp
(
pNode
->
data
);
}
free
(
pNode
);
TDMFREE
(
pNode
);
}
}
}
else
{
...
...
@@ -615,9 +615,9 @@ void doCleanupDataCache(SCacheObj *pCacheObj) {
__cache_lock_destroy
(
pCacheObj
);
tfree
(
pCacheObj
->
name
);
TDMFREE
(
pCacheObj
->
name
);
memset
(
pCacheObj
,
0
,
sizeof
(
SCacheObj
));
free
(
pCacheObj
);
TDMFREE
(
pCacheObj
);
}
bool
travHashTableFn
(
void
*
param
,
void
*
data
)
{
...
...
src/util/src/tcompare.c
浏览文件 @
040e4354
...
...
@@ -226,7 +226,7 @@ static int32_t compareStrPatternComp(const void* pLeft, const void* pRight) {
buf
[
sz
]
=
0
;
int32_t
ret
=
patternMatch
(
pattern
,
buf
,
sz
,
&
pInfo
);
free
(
buf
);
TDMFREE
(
buf
);
return
(
ret
==
TSDB_PATTERN_MATCH
)
?
0
:
1
;
}
...
...
src/util/src/tconfig.c
浏览文件 @
040e4354
...
...
@@ -317,7 +317,7 @@ void taosReadGlobalLogCfg() {
taosReadLogOption
(
option
,
value
);
}
tfree
(
line
);
TDMFREE
(
line
);
fclose
(
fp
);
}
...
...
@@ -369,7 +369,7 @@ bool taosReadGlobalCfg() {
fclose
(
fp
);
tfree
(
line
);
TDMFREE
(
line
);
if
(
debugFlag
&
DEBUG_TRACE
||
debugFlag
&
DEBUG_DEBUG
||
debugFlag
&
DEBUG_DUMP
)
{
taosSetAllDebugFlag
();
...
...
src/util/src/tdes.c
浏览文件 @
040e4354
...
...
@@ -58,7 +58,7 @@ char* taosDesDecode(int64_t key, char* src, int len) {
len
+=
8
;
char
*
decode
=
taosDesImp
(
keyStr
,
temp
,
len
,
DECRYPTION_MODE
);
free
(
temp
);
TDMFREE
(
temp
);
return
decode
;
}
...
...
src/util/src/tidpool.c
浏览文件 @
040e4354
...
...
@@ -31,7 +31,7 @@ void *taosInitIdPool(int maxId) {
pIdPool
->
freeList
=
calloc
(
maxId
,
sizeof
(
bool
));
if
(
pIdPool
->
freeList
==
NULL
)
{
free
(
pIdPool
);
TDMFREE
(
pIdPool
);
return
NULL
;
}
...
...
@@ -93,13 +93,13 @@ void taosIdPoolCleanUp(void *handle) {
uDebug
(
"pool:%p is cleaned"
,
pIdPool
);
if
(
pIdPool
->
freeList
)
free
(
pIdPool
->
freeList
);
if
(
pIdPool
->
freeList
)
TDMFREE
(
pIdPool
->
freeList
);
pthread_mutex_destroy
(
&
pIdPool
->
mutex
);
memset
(
pIdPool
,
0
,
sizeof
(
id_pool_t
));
free
(
pIdPool
);
TDMFREE
(
pIdPool
);
}
int
taosIdPoolNumOfUsed
(
void
*
handle
)
{
...
...
@@ -139,7 +139,7 @@ int taosUpdateIdPool(id_pool_t *handle, int maxId) {
bool
*
oldIdList
=
pIdPool
->
freeList
;
pIdPool
->
freeList
=
idList
;
free
(
oldIdList
);
TDMFREE
(
oldIdList
);
pthread_mutex_unlock
(
&
pIdPool
->
mutex
);
...
...
src/util/src/tkvstore.c
浏览文件 @
040e4354
...
...
@@ -477,11 +477,11 @@ _err:
static
void
tdFreeKVStore
(
SKVStore
*
pStore
)
{
if
(
pStore
)
{
tfree
(
pStore
->
fname
);
tfree
(
pStore
->
fsnap
);
tfree
(
pStore
->
fnew
);
TDMFREE
(
pStore
->
fname
);
TDMFREE
(
pStore
->
fsnap
);
TDMFREE
(
pStore
->
fnew
);
taosHashCleanup
(
pStore
->
map
);
free
(
pStore
);
TDMFREE
(
pStore
);
}
}
...
...
@@ -611,11 +611,11 @@ static int tdRestoreKVStore(SKVStore *pStore) {
if
(
pStore
->
aFunc
)
(
*
pStore
->
aFunc
)(
pStore
->
appH
);
tfree
(
buf
);
TDMFREE
(
buf
);
return
0
;
_err:
taosHashCancelIterate
(
pStore
->
map
,
pRecord
);
tfree
(
buf
);
TDMFREE
(
buf
);
return
-
1
;
}
src/util/src/tlog.c
浏览文件 @
040e4354
...
...
@@ -513,8 +513,8 @@ static SLogBuff *taosLogBuffNew(int32_t bufSize) {
return
tLogBuff
;
_err:
tfree
(
LOG_BUF_BUFFER
(
tLogBuff
));
tfree
(
tLogBuff
);
TDMFREE
(
LOG_BUF_BUFFER
(
tLogBuff
));
TDMFREE
(
tLogBuff
);
return
NULL
;
}
...
...
src/util/src/tmempool.c
浏览文件 @
040e4354
...
...
@@ -52,9 +52,9 @@ mpool_h taosMemPoolInit(int numOfBlock, int blockSize) {
if
(
pool_p
->
pool
==
NULL
||
pool_p
->
freeList
==
NULL
)
{
uError
(
"failed to allocate memory
\n
"
);
tfree
(
pool_p
->
freeList
);
tfree
(
pool_p
->
pool
);
tfree
(
pool_p
);
TDMFREE
(
pool_p
->
freeList
);
TDMFREE
(
pool_p
->
pool
);
TDMFREE
(
pool_p
);
return
NULL
;
}
...
...
@@ -120,8 +120,8 @@ void taosMemPoolCleanUp(mpool_h handle) {
pool_t
*
pool_p
=
(
pool_t
*
)
handle
;
pthread_mutex_destroy
(
&
pool_p
->
mutex
);
if
(
pool_p
->
pool
)
free
(
pool_p
->
pool
);
if
(
pool_p
->
freeList
)
free
(
pool_p
->
freeList
);
if
(
pool_p
->
pool
)
TDMFREE
(
pool_p
->
pool
);
if
(
pool_p
->
freeList
)
TDMFREE
(
pool_p
->
freeList
);
memset
(
pool_p
,
0
,
sizeof
(
*
pool_p
));
free
(
pool_p
);
TDMFREE
(
pool_p
);
}
src/util/src/tnettest.c
浏览文件 @
040e4354
...
...
@@ -406,7 +406,7 @@ static void taosNetTestStartup(char *host, int32_t port) {
}
}
free
(
pStep
);
TDMFREE
(
pStep
);
}
static
void
taosNetTestRpc
(
char
*
host
,
int32_t
startPort
,
int32_t
pkgLen
)
{
...
...
src/util/src/tqueue.c
浏览文件 @
040e4354
...
...
@@ -82,11 +82,11 @@ void taosCloseQueue(taos_queue param) {
while
(
pNode
)
{
pTemp
=
pNode
;
pNode
=
pNode
->
next
;
free
(
pTemp
);
TDMFREE
(
pTemp
);
}
pthread_mutex_destroy
(
&
queue
->
mutex
);
free
(
queue
);
TDMFREE
(
queue
);
uTrace
(
"queue:%p is closed"
,
queue
);
}
...
...
@@ -105,7 +105,7 @@ void taosFreeQitem(void *param) {
char
*
temp
=
(
char
*
)
param
;
temp
-=
sizeof
(
STaosQnode
);
uTrace
(
"item:%p, node:%p is freed"
,
param
,
temp
);
free
(
temp
);
TDMFREE
(
temp
);
}
int
taosWriteQitem
(
taos_queue
param
,
int
type
,
void
*
item
)
{
...
...
@@ -166,7 +166,7 @@ void *taosAllocateQall() {
}
void
taosFreeQall
(
void
*
param
)
{
free
(
param
);
TDMFREE
(
param
);
}
int
taosReadAllQitems
(
taos_queue
param
,
taos_qall
p2
)
{
...
...
@@ -251,7 +251,7 @@ void taosCloseQset(taos_qset param) {
pthread_mutex_destroy
(
&
qset
->
mutex
);
tsem_destroy
(
&
qset
->
sem
);
free
(
qset
);
TDMFREE
(
qset
);
uTrace
(
"qset:%p is closed"
,
qset
);
}
...
...
src/util/src/tref.c
浏览文件 @
040e4354
...
...
@@ -73,7 +73,7 @@ int taosOpenRef(int max, void (*fp)(void *))
lockedBy
=
calloc
(
sizeof
(
int64_t
),
(
size_t
)
max
);
if
(
lockedBy
==
NULL
)
{
free
(
nodeList
);
TDMFREE
(
nodeList
);
terrno
=
TSDB_CODE_REF_NO_MEMORY
;
return
-
1
;
}
...
...
@@ -102,8 +102,8 @@ int taosOpenRef(int max, void (*fp)(void *))
uTrace
(
"rsetId:%d is opened, max:%d, fp:%p refSetNum:%d"
,
rsetId
,
max
,
fp
,
tsRefSetNum
);
}
else
{
rsetId
=
TSDB_CODE_REF_FULL
;
free
(
nodeList
);
free
(
lockedBy
);
TDMFREE
(
nodeList
);
TDMFREE
(
lockedBy
);
uTrace
(
"run out of Ref ID, maximum:%d refSetNum:%d"
,
TSDB_REF_OBJECTS
,
tsRefSetNum
);
}
...
...
@@ -438,7 +438,7 @@ static int taosDecRefCount(int rsetId, int64_t rid, int remove) {
if
(
released
)
{
uTrace
(
"rsetId:%d p:%p rid:%"
PRId64
" is removed, count:%d, free mem: %p"
,
rsetId
,
pNode
->
p
,
rid
,
pSet
->
count
,
pNode
);
(
*
pSet
->
fp
)(
pNode
->
p
);
free
(
pNode
);
TDMFREE
(
pNode
);
taosDecRsetCount
(
pSet
);
}
...
...
@@ -485,8 +485,8 @@ static void taosDecRsetCount(SRefSet *pSet) {
pSet
->
max
=
0
;
pSet
->
fp
=
NULL
;
tfree
(
pSet
->
nodeList
);
tfree
(
pSet
->
lockedBy
);
TDMFREE
(
pSet
->
nodeList
);
TDMFREE
(
pSet
->
lockedBy
);
tsRefSetNum
--
;
uTrace
(
"rsetId:%d is cleaned, refSetNum:%d count:%d"
,
pSet
->
rsetId
,
tsRefSetNum
,
pSet
->
count
);
...
...
src/util/src/tsched.c
浏览文件 @
040e4354
...
...
@@ -201,9 +201,9 @@ void taosCleanUpScheduler(void *param) {
taosTmrStopA
(
&
pSched
->
pTimer
);
}
if
(
pSched
->
queue
)
free
(
pSched
->
queue
);
if
(
pSched
->
qthread
)
free
(
pSched
->
qthread
);
free
(
pSched
);
// fix memory leak
if
(
pSched
->
queue
)
TDMFREE
(
pSched
->
queue
);
if
(
pSched
->
qthread
)
TDMFREE
(
pSched
->
qthread
);
TDMFREE
(
pSched
);
// fix memory leak
}
// for debug purpose, dump the scheduler status every 1min.
...
...
src/util/src/tskiplist.c
浏览文件 @
040e4354
...
...
@@ -27,7 +27,7 @@ static SSkipListIterator *doCreateSkipListIterator(SSkipList *pSkipList, int32_t
static
void
tSkipListDoInsert
(
SSkipList
*
pSkipList
,
SSkipListNode
**
direction
,
SSkipListNode
*
pNode
,
bool
isForward
);
static
bool
tSkipListGetPosToPut
(
SSkipList
*
pSkipList
,
SSkipListNode
**
backward
,
void
*
pData
);
static
SSkipListNode
*
tSkipListNewNode
(
uint8_t
level
);
#define tSkipListFreeNode(n)
tfree
((n))
#define tSkipListFreeNode(n)
TDMFREE
((n))
static
SSkipListNode
*
tSkipListPutImpl
(
SSkipList
*
pSkipList
,
void
*
pData
,
SSkipListNode
**
direction
,
bool
isForward
,
bool
hasDup
);
...
...
@@ -99,12 +99,12 @@ void tSkipListDestroy(SSkipList *pSkipList) {
tSkipListUnlock
(
pSkipList
);
if
(
pSkipList
->
lock
!=
NULL
)
{
pthread_rwlock_destroy
(
pSkipList
->
lock
);
tfree
(
pSkipList
->
lock
);
TDMFREE
(
pSkipList
->
lock
);
}
tSkipListFreeNode
(
pSkipList
->
pHead
);
tSkipListFreeNode
(
pSkipList
->
pTail
);
tfree
(
pSkipList
);
TDMFREE
(
pSkipList
);
}
SSkipListNode
*
tSkipListPut
(
SSkipList
*
pSkipList
,
void
*
pData
)
{
...
...
@@ -332,7 +332,7 @@ void *tSkipListDestroyIter(SSkipListIterator *iter) {
return
NULL
;
}
tfree
(
iter
);
TDMFREE
(
iter
);
return
NULL
;
}
...
...
src/util/src/tstrbuild.c
浏览文件 @
040e4354
...
...
@@ -38,7 +38,7 @@ char* taosStringBuilderGetResult(SStringBuilder* sb, size_t* len) {
}
void
taosStringBuilderDestroy
(
SStringBuilder
*
sb
)
{
free
(
sb
->
buf
);
TDMFREE
(
sb
->
buf
);
sb
->
buf
=
NULL
;
sb
->
pos
=
0
;
sb
->
size
=
0
;
...
...
src/util/src/ttimer.c
浏览文件 @
040e4354
...
...
@@ -114,7 +114,7 @@ static void timerAddRef(tmr_obj_t* timer) { atomic_add_fetch_8(&timer->refCount,
static
void
timerDecRef
(
tmr_obj_t
*
timer
)
{
if
(
atomic_sub_fetch_8
(
&
timer
->
refCount
,
1
)
==
0
)
{
free
(
timer
);
TDMFREE
(
timer
);
}
}
...
...
@@ -575,7 +575,7 @@ void taosTmrCleanUp(void* handle) {
for
(
int
i
=
0
;
i
<
tListLen
(
wheels
);
i
++
)
{
time_wheel_t
*
wheel
=
wheels
+
i
;
pthread_mutex_destroy
(
&
wheel
->
mutex
);
free
(
wheel
->
slots
);
TDMFREE
(
wheel
->
slots
);
}
pthread_mutex_destroy
(
&
tmrCtrlMutex
);
...
...
@@ -585,12 +585,12 @@ void taosTmrCleanUp(void* handle) {
tmr_obj_t
*
t
=
list
->
timers
;
while
(
t
!=
NULL
)
{
tmr_obj_t
*
next
=
t
->
mnext
;
free
(
t
);
TDMFREE
(
t
);
t
=
next
;
}
}
free
(
timerMap
.
slots
);
free
(
tmrCtrls
);
TDMFREE
(
timerMap
.
slots
);
TDMFREE
(
tmrCtrls
);
tmrDebug
(
"timer module is cleaned up"
);
}
...
...
src/util/src/tworker.c
浏览文件 @
040e4354
...
...
@@ -48,7 +48,7 @@ void tWorkerCleanup(SWorkerPool *pPool) {
}
}
free
(
pPool
->
worker
);
TDMFREE
(
pPool
->
worker
);
taosCloseQset
(
pPool
->
qset
);
pthread_mutex_destroy
(
&
pPool
->
mutex
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录