fix:[TD-31962]memory leak by crash_gen

This commit is contained in:
wangmm0220 2024-09-12 16:09:09 +08:00
parent 1850f3fb52
commit 295a34fc55
3 changed files with 7 additions and 5 deletions

View File

@ -941,7 +941,7 @@ void taos_init_imp(void) {
tscInitRes = TSDB_CODE_OUT_OF_MEMORY;
return;
}
// taosHashSetFreeFp(appInfo.pInstMap, destroyAppInst); avoid heap use after free
taosHashSetFreeFp(appInfo.pInstMap, destroyAppInst);
deltaToUtcInitOnce();
char logDirName[64] = {0};

View File

@ -77,7 +77,10 @@ bool chkRequestKilled(void* param) {
return killed;
}
void cleanupAppInfo() { taosHashCleanup(appInfo.pInstMap); }
void cleanupAppInfo() {
taosHashCleanup(appInfo.pInstMap);
taosHashCleanup(appInfo.pInstMapByClusterId);
}
static int32_t taosConnectImpl(const char* user, const char* auth, const char* db, __taos_async_fn_t fp, void* param,
SAppInstInfo* pAppInfo, int connType, STscObj** pTscObj);

View File

@ -73,6 +73,8 @@ void taos_cleanup(void) {
tscWarn("failed to cleanup task queue");
}
tmqMgmtClose();
int32_t id = clientReqRefPool;
clientReqRefPool = -1;
taosCloseRef(id);
@ -87,9 +89,6 @@ void taos_cleanup(void) {
tscDebug("rpc cleanup");
taosConvDestroy();
tmqMgmtClose();
DestroyRegexCache();
tscInfo("all local resources released");