[chainmaker][#1330]add resposone len check
@@ -440,8 +440,10 @@ BOAT_RESULT BoatChainmakerContractInvoke(BoatChainmakerTx *tx_ptr, char *method,
if (transaction_info_with_rwset->transaction->result->code == BOAT_SUCCESS)
{
len = sprintf(response_data->contract_result, "gas_used:%lld ", transaction_info_with_rwset->transaction->result->contract_result->gas_used);
- len += sprintf(response_data->contract_result + len, "contract_event:<");
+ if (transaction_info_with_rwset->transaction->result->contract_result->n_contract_event != 0)
+ {
+ len += sprintf(response_data->contract_result + len, "contract_event:<");
for (i = 0; i < transaction_info_with_rwset->transaction->result->contract_result->n_contract_event; i++)
{
len += sprintf(response_data->contract_result + len, "topic:\"%s\"", transaction_info_with_rwset->transaction->result->contract_result->contract_event[i]->topic);
@@ -455,6 +457,8 @@ BOAT_RESULT BoatChainmakerContractInvoke(BoatChainmakerTx *tx_ptr, char *method,
}
len += sprintf(response_data->contract_result + len, ">");
}
+ }
+
common__transaction_info_with_rwset__free_unpacked(transaction_info_with_rwset, NULL);
break;
}
