Merge pull request #23830 from taosdata/fix/liaohj
fix(stream): fix invalid free.
This commit is contained in:
commit
8b406c0a19
|
@ -756,10 +756,11 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
|
|||
SMnode *pMnode = pReq->info.node;
|
||||
int32_t code = -1;
|
||||
SStreamObj *pStream = NULL;
|
||||
SDbObj * pDb = NULL;
|
||||
SCMCreateStreamReq createStreamReq = {0};
|
||||
SStreamObj streamObj = {0};
|
||||
char *sql = NULL;
|
||||
int32_t sqlLen = 0;
|
||||
|
||||
SCMCreateStreamReq createStreamReq = {0};
|
||||
if (tDeserializeSCMCreateStreamReq(pReq->pCont, pReq->contLen, &createStreamReq) != 0) {
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
goto _OVER;
|
||||
|
@ -790,8 +791,6 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
|
|||
goto _OVER;
|
||||
}
|
||||
|
||||
char* sql = NULL;
|
||||
int32_t sqlLen = 0;
|
||||
if (createStreamReq.sql != NULL) {
|
||||
sqlLen = strlen(createStreamReq.sql);
|
||||
sql = taosMemoryMalloc(sqlLen + 1);
|
||||
|
@ -879,14 +878,13 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
|
|||
// reuse this function for stream
|
||||
|
||||
if (sql != NULL && sqlLen > 0) {
|
||||
auditRecord(pReq, pMnode->clusterId, "createStream", dbname.dbname, name.dbname, sql,
|
||||
sqlLen);
|
||||
}
|
||||
else{
|
||||
auditRecord(pReq, pMnode->clusterId, "createStream", dbname.dbname, name.dbname, sql, sqlLen);
|
||||
} else {
|
||||
char detail[1000] = {0};
|
||||
sprintf(detail, "dbname:%s, stream name:%s", dbname.dbname, name.dbname);
|
||||
auditRecord(pReq, pMnode->clusterId, "createStream", dbname.dbname, name.dbname, detail, strlen(detail));
|
||||
}
|
||||
|
||||
_OVER:
|
||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||
mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr());
|
||||
|
|
Loading…
Reference in New Issue