fix:[TS-4921] asan error

This commit is contained in:
wangmm0220 2024-06-22 04:01:53 +08:00
parent 5dcfed2d51
commit fe6eb5d8c3
3 changed files with 15 additions and 15 deletions

View File

@ -309,7 +309,7 @@ void stopAllRequests(SHashObj *pRequests) {
} }
void destroyAppInst(void *info) { void destroyAppInst(void *info) {
SAppInstInfo* pAppInfo = (SAppInstInfo*)info; SAppInstInfo* pAppInfo = *(SAppInstInfo**)info;
tscDebug("destroy app inst mgr %p", pAppInfo); tscDebug("destroy app inst mgr %p", pAppInfo);
taosThreadMutexLock(&appInfo.mutex); taosThreadMutexLock(&appInfo.mutex);

View File

@ -147,7 +147,7 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas
} }
p->pAppHbMgr = appHbMgrInit(p, key); p->pAppHbMgr = appHbMgrInit(p, key);
if (NULL == p->pAppHbMgr) { if (NULL == p->pAppHbMgr) {
destroyAppInst(p); destroyAppInst(&p);
taosThreadMutexUnlock(&appInfo.mutex); taosThreadMutexUnlock(&appInfo.mutex);
taosMemoryFreeClear(key); taosMemoryFreeClear(key);
return NULL; return NULL;

View File

@ -28,16 +28,16 @@ static int32_t getSlowLogTmpDir(char* tmpPath, int32_t size){
return 0; return 0;
} }
static void destroyCounter(void* data){ //static void destroyCounter(void* data){
if (data == NULL) { // if (data == NULL) {
return; // return;
} // }
taos_counter_t* conuter = *(taos_counter_t**)data; // taos_counter_t* conuter = *(taos_counter_t**)data;
if(conuter == NULL){ // if(conuter == NULL){
return; // return;
} // }
taos_counter_destroy(conuter); // taos_counter_destroy(conuter);
} //}
static void destroyClientFile(void* data){ static void destroyClientFile(void* data){
if (data == NULL) { if (data == NULL) {
@ -61,7 +61,7 @@ static void destroyMonitorClient(void* data){
} }
taosHashCleanup(pMonitor->counters); taosHashCleanup(pMonitor->counters);
taos_collector_registry_destroy(pMonitor->registry); taos_collector_registry_destroy(pMonitor->registry);
taos_collector_destroy(pMonitor->colector); // taos_collector_destroy(pMonitor->colector);
taosMemoryFree(pMonitor); taosMemoryFree(pMonitor);
} }
@ -405,7 +405,7 @@ void monitorCreateClient(int64_t clusterId) {
uError("failed to create monitor counters"); uError("failed to create monitor counters");
goto fail; goto fail;
} }
taosHashSetFreeFp(pMonitor->counters, destroyCounter); // taosHashSetFreeFp(pMonitor->counters, destroyCounter);
if(taosHashPut(monitorCounterHash, &clusterId, LONG_BYTES, &pMonitor, POINTER_BYTES) != 0){ if(taosHashPut(monitorCounterHash, &clusterId, LONG_BYTES, &pMonitor, POINTER_BYTES) != 0){
uError("failed to put monitor client to hash"); uError("failed to put monitor client to hash");
@ -606,7 +606,7 @@ void* monitorThreadFunc(void *param){
} }
monitorFreeSlowLogData(slowLogData); monitorFreeSlowLogData(slowLogData);
taosFreeQitem(slowLogData); taosFreeQitem(slowLogData);
tsem2_wait(&monitorSem); tsem2_timewait(&monitorSem, 500);
} }
taosCloseQueue(monitorQueue); taosCloseQueue(monitorQueue);