fix:memory leak
This commit is contained in:
parent
a58cb1a28c
commit
208ba2ef4d
|
@ -1757,6 +1757,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
|
||||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosMemoryFreeClear(pResultInfo->convertJson);
|
||||||
pResultInfo->convertJson = taosMemoryCalloc(1, dataLen);
|
pResultInfo->convertJson = taosMemoryCalloc(1, dataLen);
|
||||||
if (pResultInfo->convertJson == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (pResultInfo->convertJson == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
char* p1 = pResultInfo->convertJson;
|
char* p1 = pResultInfo->convertJson;
|
||||||
|
|
|
@ -8008,6 +8008,9 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau
|
||||||
if (pTagSchema->type == TSDB_DATA_TYPE_JSON) {
|
if (pTagSchema->type == TSDB_DATA_TYPE_JSON) {
|
||||||
isJson = true;
|
isJson = true;
|
||||||
code = buildJsonTagVal(pCxt, pTagSchema, pVal, pTagArray, ppTag);
|
code = buildJsonTagVal(pCxt, pTagSchema, pVal, pTagArray, ppTag);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
nodesDestroyNode((SNode*)pVal);
|
||||||
|
}
|
||||||
taosArrayPush(tagName, pTagSchema->name);
|
taosArrayPush(tagName, pTagSchema->name);
|
||||||
} else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL && !pVal->isNull) {
|
} else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL && !pVal->isNull) {
|
||||||
char* tmpVal = nodesGetValueFromNode(pVal);
|
char* tmpVal = nodesGetValueFromNode(pVal);
|
||||||
|
@ -8328,13 +8331,7 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS
|
||||||
SArray* pTagVals = taosArrayInit(1, sizeof(STagVal));
|
SArray* pTagVals = taosArrayInit(1, sizeof(STagVal));
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
STag* pTag = NULL;
|
STag* pTag = NULL;
|
||||||
do {
|
code = parseJsontoTagData(pStmt->pVal->literal, pTagVals, &pTag, &pCxt->msgBuf);
|
||||||
code = parseJsontoTagData(pStmt->pVal->literal, pTagVals, &pTag, &pCxt->msgBuf);
|
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (0);
|
|
||||||
|
|
||||||
taosArrayDestroy(pTagVals);
|
taosArrayDestroy(pTagVals);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -416,7 +416,7 @@ int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, voi
|
||||||
end:
|
end:
|
||||||
taosHashCleanup(keyHash);
|
taosHashCleanup(keyHash);
|
||||||
if (retCode == TSDB_CODE_SUCCESS) {
|
if (retCode == TSDB_CODE_SUCCESS) {
|
||||||
tTagNew(pTagVals, 1, true, ppTag);
|
retCode = tTagNew(pTagVals, 1, true, ppTag);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < taosArrayGetSize(pTagVals); ++i) {
|
for (int i = 0; i < taosArrayGetSize(pTagVals); ++i) {
|
||||||
STagVal* p = (STagVal*)taosArrayGet(pTagVals, i);
|
STagVal* p = (STagVal*)taosArrayGet(pTagVals, i);
|
||||||
|
|
Loading…
Reference in New Issue