fix(stream): fix invalid free.

This commit is contained in:
Haojun Liao 2023-11-27 18:49:22 +08:00
parent c5aba60899
commit 9649db9003
1 changed files with 7 additions and 8 deletions

View File

@ -755,13 +755,14 @@ static int32_t checkForNumOfStreams(SMnode *pMnode, SStreamObj *pStreamObj) { /
} }
static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
SMnode * pMnode = pReq->info.node; SMnode *pMnode = pReq->info.node;
int32_t code = -1; int32_t code = -1;
SStreamObj * pStream = NULL; SStreamObj *pStream = NULL;
SDbObj * pDb = NULL; SStreamObj streamObj = {0};
SCMCreateStreamReq createStreamReq = {0}; char *sql = NULL;
SStreamObj streamObj = {0}; int32_t sqlLen = 0;
SCMCreateStreamReq createStreamReq = {0};
if (tDeserializeSCMCreateStreamReq(pReq->pCont, pReq->contLen, &createStreamReq) != 0) { if (tDeserializeSCMCreateStreamReq(pReq->pCont, pReq->contLen, &createStreamReq) != 0) {
terrno = TSDB_CODE_INVALID_MSG; terrno = TSDB_CODE_INVALID_MSG;
goto _OVER; goto _OVER;
@ -792,8 +793,6 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
goto _OVER; goto _OVER;
} }
char* sql = NULL;
int32_t sqlLen = 0;
if(createStreamReq.sql != NULL){ if(createStreamReq.sql != NULL){
sqlLen = strlen(createStreamReq.sql); sqlLen = strlen(createStreamReq.sql);
sql = taosMemoryMalloc(sqlLen + 1); sql = taosMemoryMalloc(sqlLen + 1);