forked from loafle/openapi-generator-original
[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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user