fix some memory lost

This commit is contained in:
slguan 2020-04-14 00:01:31 +08:00
parent 5b33531389
commit 1fb5a8c2fd
5 changed files with 12 additions and 2 deletions

View File

@ -249,6 +249,7 @@ static bool dnodeReadMnodeIpList() {
PARSE_OVER: PARSE_OVER:
free(content); free(content);
cJSON_Delete(root);
fclose(fp); fclose(fp);
return ret; return ret;
} }

View File

@ -167,6 +167,7 @@ void sdbCleanUp() {
sem_destroy(&tsSdbSync->sem); sem_destroy(&tsSdbSync->sem);
pthread_mutex_destroy(&tsSdbSync->mutex); pthread_mutex_destroy(&tsSdbSync->mutex);
walClose(tsSdbSync->wal); walClose(tsSdbSync->wal);
free(tsSdbSync);
tsSdbSync = NULL; tsSdbSync = NULL;
} }
} }
@ -576,5 +577,5 @@ void sdbCloseTable(void *handle) {
pthread_mutex_destroy(&pTable->mutex); pthread_mutex_destroy(&pTable->mutex);
sdbTrace("table:%s, is closed, numOfTables:%d", pTable->tableName, tsSdbNumOfTables); sdbTrace("table:%s, is closed, numOfTables:%d", pTable->tableName, tsSdbNumOfTables);
tfree(pTable); free(pTable);
} }

View File

@ -33,6 +33,7 @@
#define TG_PASS_URL_POS 3 #define TG_PASS_URL_POS 3
void tgInitHandle(HttpServer *pServer); void tgInitHandle(HttpServer *pServer);
void tgCleanupHandle();
bool tgProcessRquest(struct HttpContext *pContext); bool tgProcessRquest(struct HttpContext *pContext);

View File

@ -122,12 +122,14 @@ void httpStopSystem() {
if (httpServer != NULL) { if (httpServer != NULL) {
httpServer->online = false; httpServer->online = false;
} }
tgCleanupHandle();
} }
void httpCleanUpSystem() { void httpCleanUpSystem() {
httpPrint("http service cleanup"); httpPrint("http service cleanup");
httpStopSystem(); httpStopSystem();
#if 0
#if 1
if (httpServer == NULL) { if (httpServer == NULL) {
return; return;
} }

View File

@ -116,6 +116,7 @@ void tgFreeSchemas() {
} }
free(tgSchemas.schemas); free(tgSchemas.schemas);
tgSchemas.size = 0; tgSchemas.size = 0;
tgSchemas.schemas = NULL;
} }
} }
@ -290,6 +291,10 @@ void tgInitHandle(HttpServer *pServer) {
httpAddMethod(pServer, &tgDecodeMethod); httpAddMethod(pServer, &tgDecodeMethod);
} }
void tgCleanupHandle() {
tgFreeSchemas();
}
bool tgGetUserFromUrl(HttpContext *pContext) { bool tgGetUserFromUrl(HttpContext *pContext) {
HttpParser *pParser = &pContext->parser; HttpParser *pParser = &pContext->parser;
if (pParser->path[TG_USER_URL_POS].len > TSDB_USER_LEN - 1 || pParser->path[TG_USER_URL_POS].len <= 0) { if (pParser->path[TG_USER_URL_POS].len > TSDB_USER_LEN - 1 || pParser->path[TG_USER_URL_POS].len <= 0) {