[TD-5534]<fix>:fix the coverity high risk of client
This commit is contained in:
parent
4216a400a3
commit
211c079b07
|
@ -726,13 +726,12 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_prepareStmtImp(J
|
|||
|
||||
TAOS_STMT* pStmt = taos_stmt_init(tscon);
|
||||
int32_t code = taos_stmt_prepare(pStmt, str, len);
|
||||
tfree(str);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
jniError("jobj:%p, conn:%p, code:%s", jobj, tscon, tstrerror(code));
|
||||
free(str);
|
||||
return JNI_TDENGINE_ERROR;
|
||||
}
|
||||
|
||||
free(str);
|
||||
return (jlong) pStmt;
|
||||
}
|
||||
|
||||
|
@ -920,10 +919,6 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setTableNameTagsI
|
|||
char* curTags = tagsData;
|
||||
|
||||
TAOS_BIND *tagsBind = calloc(numOfTags, sizeof(TAOS_BIND));
|
||||
if (tagsBind == NULL) {
|
||||
jniError("numOfTags:%d, alloc memory failed", numOfTags);
|
||||
return JNI_OUT_OF_MEMORY;
|
||||
}
|
||||
for(int32_t i = 0; i < numOfTags; ++i) {
|
||||
tagsBind[i].buffer_type = typeArray[i];
|
||||
tagsBind[i].buffer = curTags;
|
||||
|
@ -942,14 +937,13 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setTableNameTagsI
|
|||
tfree(lengthArray);
|
||||
tfree(typeArray);
|
||||
tfree(nullArray);
|
||||
tfree(tagsBind);
|
||||
(*env)->ReleaseStringUTFChars(env, tableName, name);
|
||||
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
jniError("jobj:%p, conn:%p, code:%s", jobj, tsconn, tstrerror(code));
|
||||
free(tagsBind);
|
||||
return JNI_TDENGINE_ERROR;
|
||||
}
|
||||
free(tagsBind);
|
||||
return JNI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -979,12 +973,11 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp(J
|
|||
(*env)->ReleaseStringUTFChars(env, line, c_lines[i]);
|
||||
}
|
||||
|
||||
tfree(c_lines);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
jniError("jobj:%p, conn:%p, code:%s", jobj, taos, tstrerror(code));
|
||||
free(c_lines);
|
||||
|
||||
return JNI_TDENGINE_ERROR;
|
||||
}
|
||||
|
||||
free(c_lines);
|
||||
return code;
|
||||
}
|
|
@ -443,11 +443,10 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu
|
|||
}
|
||||
|
||||
pModel = createColumnModel(pSchema, (int32_t)size, capacity);
|
||||
tfree(pSchema);
|
||||
if (pModel == NULL){
|
||||
tfree(pSchema);
|
||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
}
|
||||
tfree(pSchema);
|
||||
|
||||
int32_t pg = DEFAULT_PAGE_SIZE;
|
||||
int32_t overhead = sizeof(tFilePage);
|
||||
|
|
|
@ -701,14 +701,14 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols
|
|||
|
||||
TAOS_STMT* stmt = taos_stmt_init(taos);
|
||||
if (stmt == NULL) {
|
||||
free(sql);
|
||||
tfree(sql);
|
||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
}
|
||||
code = taos_stmt_prepare(stmt, sql, (unsigned long)strlen(sql));
|
||||
free(sql);
|
||||
tfree(sql);
|
||||
|
||||
if (code != 0) {
|
||||
free(stmt);
|
||||
tfree(stmt);
|
||||
tscError("%s", taos_stmt_errstr(stmt));
|
||||
return code;
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols
|
|||
code = taos_stmt_set_tbname(stmt, cTableName);
|
||||
if (code != 0) {
|
||||
tscError("%s", taos_stmt_errstr(stmt));
|
||||
free(stmt);
|
||||
tfree(stmt);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -727,13 +727,13 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols
|
|||
code = taos_stmt_bind_param(stmt, colsBinds);
|
||||
if (code != 0) {
|
||||
tscError("%s", taos_stmt_errstr(stmt));
|
||||
free(stmt);
|
||||
tfree(stmt);
|
||||
return code;
|
||||
}
|
||||
code = taos_stmt_add_batch(stmt);
|
||||
if (code != 0) {
|
||||
tscError("%s", taos_stmt_errstr(stmt));
|
||||
free(stmt);
|
||||
tfree(stmt);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8362,7 +8362,7 @@ static int32_t doValidateSubquery(SSqlNode* pSqlNode, int32_t index, SSqlObj* pS
|
|||
|
||||
if (subInfo->aliasName.n > 0) {
|
||||
if (subInfo->aliasName.n >= TSDB_TABLE_FNAME_LEN) {
|
||||
free(pTableMetaInfo1);
|
||||
tfree(pTableMetaInfo1);
|
||||
return invalidOperationMsg(msgBuf, "subquery alias name too long");
|
||||
}
|
||||
|
||||
|
@ -8376,7 +8376,7 @@ static int32_t doValidateSubquery(SSqlNode* pSqlNode, int32_t index, SSqlObj* pS
|
|||
|
||||
STableMetaInfo** tmp = realloc(pQueryInfo->pTableMetaInfo, (pQueryInfo->numOfTables + 1) * POINTER_BYTES);
|
||||
if (tmp == NULL) {
|
||||
free(pTableMetaInfo1);
|
||||
tfree(pTableMetaInfo1);
|
||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
|
|
|
@ -2055,7 +2055,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
|
|||
}
|
||||
if (!tIsValidSchema(pTableMeta->schema, pTableMeta->tableInfo.numOfColumns, pTableMeta->tableInfo.numOfTags)) {
|
||||
tscError("0x%"PRIx64" invalid table meta from mnode, name:%s", pSql->self, tNameGetTableName(&pTableMetaInfo->name));
|
||||
free(pTableMeta);
|
||||
tfree(pTableMeta);
|
||||
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -2476,7 +2476,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
|
|||
pState->states = calloc(pState->numOfSub, sizeof(*pState->states));
|
||||
if (pState->states == NULL) {
|
||||
pRes->code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
tscDestroyGlobalMergerEnv(pMemoryBuf, pDesc,pState->numOfSub);
|
||||
tscDestroyGlob alMergerEnv(pMemoryBuf, pDesc,pState->numOfSub);
|
||||
|
||||
tscAsyncResultOnError(pSql);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue