diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 7af6a080ed0b1c9f4edd46bf6631f0c53c76554a..7064f3981dfec4c8366ef8855d0be4b5baeda3a1 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -4192,9 +4192,19 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) { int32_t doInitSubState(SSqlObj* pSql, int32_t numOfSubqueries) { //bug fix. Above doInitSubState level, the loop invocation with the same SSqlObj will be fail. - //assert(pSql->subState.numOfSub == 0 && pSql->pSubs == NULL && pSql->subState.states == NULL); + //assert(pSql->subState.numOfSub == 0 && pSql->pSubs == NULL && pSql->subState.states == NULL); + if(pSql->pSubs) { + free(pSql->pSubs); + pSql->pSubs = NULL; + } + + if(pSql->subState.states) { + free(pSql->subState.states); + pSql->subState.states = NULL; + } + pSql->subState.numOfSub = numOfSubqueries; - + pSql->pSubs = calloc(pSql->subState.numOfSub, POINTER_BYTES); pSql->subState.states = calloc(pSql->subState.numOfSub, sizeof(int8_t));