diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index e29a21d08eeb4051602e7749be47444be291e365..dc9fa33595defda2234d51f4c936a02551b7cefb 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -96,6 +96,7 @@ void cfgCleanup(SConfig *pCfg) { SConfigItem *pItem = taosHashIterate(pCfg->hash, NULL); while (pItem != NULL) { cfgFreeItem(pItem); + tfree(pItem->name); pItem = taosHashIterate(pCfg->hash, pItem); } taosHashCleanup(pCfg->hash); @@ -249,9 +250,7 @@ static int32_t cfgSetString(SConfigItem *pItem, const char *value, ECfgSrcType s } static int32_t cfgSetDir(SConfigItem *pItem, const char *value, ECfgSrcType stype) { - char *tmp = strdup(value); - if (tmp == NULL || cfgCheckAndSetDir(pItem, value) != 0) { - free(tmp); + if (cfgCheckAndSetDir(pItem, value) != 0) { terrno = TSDB_CODE_OUT_OF_MEMORY; uError("cfg:%s, type:%s src:%s value:%s failed to dup since %s, use last src:%s value:%s", pItem->name, cfgDtypeStr(pItem->dtype), cfgStypeStr(stype), value, terrstr(), cfgStypeStr(pItem->stype), pItem->str); @@ -263,9 +262,7 @@ static int32_t cfgSetDir(SConfigItem *pItem, const char *value, ECfgSrcType styp } static int32_t cfgSetLocale(SConfigItem *pItem, const char *value, ECfgSrcType stype) { - char *tmp = strdup(value); - if (tmp == NULL || cfgCheckAndSetLocale(pItem, value) != 0) { - free(tmp); + if (cfgCheckAndSetLocale(pItem, value) != 0) { terrno = TSDB_CODE_OUT_OF_MEMORY; uError("cfg:%s, type:%s src:%s value:%s failed to dup since %s, use last src:%s value:%s", pItem->name, cfgDtypeStr(pItem->dtype), cfgStypeStr(stype), value, terrstr(), cfgStypeStr(pItem->stype), pItem->str); @@ -277,9 +274,7 @@ static int32_t cfgSetLocale(SConfigItem *pItem, const char *value, ECfgSrcType s } static int32_t cfgSetCharset(SConfigItem *pItem, const char *value, ECfgSrcType stype) { - char *tmp = strdup(value); - if (tmp == NULL || cfgCheckAndSetCharset(pItem, value) != 0) { - free(tmp); + if (cfgCheckAndSetCharset(pItem, value) != 0) { terrno = TSDB_CODE_OUT_OF_MEMORY; uError("cfg:%s, type:%s src:%s value:%s failed to dup since %s, use last src:%s value:%s", pItem->name, cfgDtypeStr(pItem->dtype), cfgStypeStr(stype), value, terrstr(), cfgStypeStr(pItem->stype), pItem->str); @@ -291,9 +286,7 @@ static int32_t cfgSetCharset(SConfigItem *pItem, const char *value, ECfgSrcType } static int32_t cfgSetTimezone(SConfigItem *pItem, const char *value, ECfgSrcType stype) { - char *tmp = strdup(value); - if (tmp == NULL || cfgCheckAndSetTimezone(pItem, value) != 0) { - free(tmp); + if (cfgCheckAndSetTimezone(pItem, value) != 0) { terrno = TSDB_CODE_OUT_OF_MEMORY; uError("cfg:%s, type:%s src:%s value:%s failed to dup since %s, use last src:%s value:%s", pItem->name, cfgDtypeStr(pItem->dtype), cfgStypeStr(stype), value, terrstr(), cfgStypeStr(pItem->stype), pItem->str); diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index e8963c97850f7b32197c28a72cb81857cc6643f5..2ed8d6e347357f458e3035b6e877717cda669d50 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -135,8 +135,6 @@ static void taosStopLog() { void taosCloseLog() { taosStopLog(); - // tsem_post(&(tsLogObj.logHandle->buffNotEmpty)); - taosMsleep(LOG_MAX_INTERVAL / 1000); if (taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) { pthread_join(tsLogObj.logHandle->asyncThread, NULL); } @@ -495,12 +493,6 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, . if (dflag & DEBUG_SCREEN) write(1, buffer, (uint32_t)len); } -#if 0 -void taosCloseLog() { - taosCloseLogByFd(tsLogObj.logHandle->pFile); -} -#endif - static void taosCloseLogByFd(TdFilePtr pFile) { if (pFile != NULL) { taosUnLockLogFile(pFile); @@ -533,15 +525,6 @@ _err: return NULL; } -#if 0 -static void taosLogBuffDestroy(SLogBuff *tLogBuff) { - tsem_destroy(&(tLogBuff->buffNotEmpty)); - pthread_mutex_destroy(&(tLogBuff->buffMutex)); - free(tLogBuff->buffer); - tfree(tLogBuff); -} -#endif - static void taosCopyLogBuffer(SLogBuff *tLogBuff, int32_t start, int32_t end, char *msg, int32_t msgLen) { if (start > end) { memcpy(LOG_BUF_BUFFER(tLogBuff) + end, msg, msgLen);