fix: fix tsc query memory leak

This commit is contained in:
dapan1121 2022-10-21 17:00:11 +08:00
parent ac542e9164
commit a80f382c5d
1 changed files with 3 additions and 11 deletions

View File

@ -190,28 +190,20 @@ int32_t nodesReleaseAllocator(int64_t allocatorId) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
SNodeAllocator* pAllocator = taosAcquireRef(g_allocatorReqRefPool, allocatorId); if (NULL == g_pNodeAllocator) {
if (NULL == pAllocator) {
return terrno;
}
int32_t code = taosThreadMutexTryLock(&pAllocator->mutex);
if (EBUSY != code) {
nodesError("allocator id %" PRIx64 nodesError("allocator id %" PRIx64
" release failed: The nodesReleaseAllocator function needs to be called after the nodesAcquireAllocator " " release failed: The nodesReleaseAllocator function needs to be called after the nodesAcquireAllocator "
"function is called!", "function is called!",
allocatorId); allocatorId);
if (0 == code) {
taosThreadMutexUnlock(&pAllocator->mutex);
}
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
SNodeAllocator* pAllocator = g_pNodeAllocator;
g_pNodeAllocator = NULL; g_pNodeAllocator = NULL;
taosThreadMutexUnlock(&pAllocator->mutex); taosThreadMutexUnlock(&pAllocator->mutex);
return taosReleaseRef(g_allocatorReqRefPool, allocatorId); return taosReleaseRef(g_allocatorReqRefPool, allocatorId);
} }
int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId) { int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId) {
if (allocatorId <= 0) { if (allocatorId <= 0) {
return 0; return 0;