fix: free before read issue

This commit is contained in:
dapan1121 2024-11-25 15:53:56 +08:00
parent 8455949575
commit 44d16f78fe
2 changed files with 2 additions and 3 deletions

View File

@ -41,9 +41,8 @@ void* mpDirectCalloc(SMemPool* pPool, SMPJob* pJob, int64_t num, int64_t size) {
}
void mpDirectFree(SMemPool* pPool, SMPJob* pJob, void *ptr) {
taosMemFree(ptr);
(void)atomic_sub_fetch_64(&pJob->job.allocMemSize, taosMemSize(ptr));
taosMemFree(ptr);
}

View File

@ -1730,7 +1730,7 @@ int32_t taosMemoryPoolInit(mpReserveFailFp failFp, mpReserveReachFp reachFp) {
void taosAutoMemoryFree(void *ptr) {
if (NULL != gMemPoolHandle) {
if (NULL != gMemPoolHandle && threadPoolEnabled && threadPoolSession) {
taosMemPoolFree(gMemPoolHandle, threadPoolSession, ptr, __FILE__, __LINE__);
} else {
taosMemFree(ptr);