diff --git a/src/modules/http/src/gcJson.c b/src/modules/http/src/gcJson.c index 0cb20ec7e1..ecd9235644 100644 --- a/src/modules/http/src/gcJson.c +++ b/src/modules/http/src/gcJson.c @@ -119,7 +119,7 @@ bool gcBuildQueryJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, cmd->numOfRows += numOfRows; } - for (int i = 0; i < numOfRows; ++i) { + for (int k = 0; k < numOfRows; ++k) { TAOS_ROW row = taos_fetch_row(result); // for group by diff --git a/src/modules/http/src/restJson.c b/src/modules/http/src/restJson.c index 8aa0ac5069..6c04d39f45 100644 --- a/src/modules/http/src/restJson.c +++ b/src/modules/http/src/restJson.c @@ -94,7 +94,7 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, int num_fields = taos_num_fields(result); TAOS_FIELD *fields = taos_fetch_fields(result); - for (int i = 0; i < numOfRows; ++i) { + for (int k = 0; k < numOfRows; ++k) { TAOS_ROW row = taos_fetch_row(result); // data row array begin diff --git a/src/modules/http/src/tgHandle.c b/src/modules/http/src/tgHandle.c index ac17d6da09..80a178c776 100644 --- a/src/modules/http/src/tgHandle.c +++ b/src/modules/http/src/tgHandle.c @@ -262,6 +262,8 @@ int tgReadSchema(const char *fileName) { size_t result = fread(content, 1, contentSize, fp); if (result != contentSize) { httpError("failed to read telegraf schema file:%s", fileName); + fclose(fp); + free(content); return -1; }