[C][Client]Fix data lost when libcurl write-data callback function is called multiple times (#5828)

* [C][Client]Fix the defect of data lost when libcurl write-data callback function (configured by CURLOPT_WRITEFUNCTION) is called multiple times.

* [C][Client]Fix data lost when libcurl write-data callback function is called multiple times (Reset count)
This commit is contained in:
Hui Yu
2020-04-16 12:45:44 +08:00
committed by GitHub
parent 7a0242311f
commit 41664b3ba8
8 changed files with 64 additions and 8 deletions

View File

@@ -63,6 +63,8 @@ StoreAPI_deleteOrder(apiClient_t *apiClient, char * orderId )
end:
if (apiClient->dataReceived) {
free(apiClient->dataReceived);
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
}
@@ -121,6 +123,8 @@ StoreAPI_getInventory(apiClient_t *apiClient)
if (apiClient->dataReceived) {
free(apiClient->dataReceived);
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
}
@@ -201,6 +205,8 @@ StoreAPI_getOrderById(apiClient_t *apiClient, long orderId )
//return type
if (apiClient->dataReceived) {
free(apiClient->dataReceived);
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
}
@@ -272,6 +278,8 @@ StoreAPI_placeOrder(apiClient_t *apiClient, order_t * body )
//return type
if (apiClient->dataReceived) {
free(apiClient->dataReceived);
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
}