From 24eae824ecec5b7239a9cbf2346000929593745c Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 30 Jun 2020 23:19:00 +0800 Subject: [PATCH] Invalid write while create child ctable --- src/mnode/src/mnodeTable.c | 6 ++++-- src/plugins/http/src/httpSql.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 23b62f1aa3..82322d43b8 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -382,11 +382,13 @@ static void mnodeAddTableIntoStable(SSuperTableObj *pStable, SChildTableObj *pCt pStable->numOfTables++; if (pStable->vgHash == NULL) { - pStable->vgHash = taosHashInit(100000, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false); + pStable->vgHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false); } if (pStable->vgHash != NULL) { - taosHashPut(pStable->vgHash, (char *)&pCtable->vgId, sizeof(pCtable->vgId), &pCtable->vgId, sizeof(pCtable->vgId)); + if (taosHashGet(pStable->vgHash, &pCtable->vgId, sizeof(pCtable->vgId)) == NULL) { + taosHashPut(pStable->vgHash, &pCtable->vgId, sizeof(pCtable->vgId), &pCtable->vgId, sizeof(pCtable->vgId)); + } } } diff --git a/src/plugins/http/src/httpSql.c b/src/plugins/http/src/httpSql.c index d0e9b005fd..9d3efca01d 100644 --- a/src/plugins/http/src/httpSql.c +++ b/src/plugins/http/src/httpSql.c @@ -359,6 +359,8 @@ void httpExecCmd(HttpContext *pContext) { void httpProcessRequestCb(void *param, TAOS_RES *result, int code) { HttpContext *pContext = param; + taos_free_result(result); + if (pContext == NULL) return; if (code < 0) {