diff --git a/include/common/tmsg.h b/include/common/tmsg.h index d9e034a159..c973e7364f 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -2622,6 +2622,9 @@ static FORCE_INLINE void tdDestroySVCreateTbReq(SVCreateTbReq* req) { } else if (req->type == TSDB_NORMAL_TABLE) { taosMemoryFreeClear(req->ntb.schemaRow.pSchema); } + if(pReq->sql != NULL){ + taosMemoryFree(pReq->sql); + } } typedef struct { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index a268a3547a..1426ac01fc 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -50,7 +50,9 @@ #define FREESQL() \ do { \ - taosMemoryFree(pReq->sql); \ + if(pReq->sql != NULL){ \ + taosMemoryFree(pReq->sql); \ + } \ pReq->sql = NULL; \ } while (0)