cpp-qt5-client: fix memory leak in api-body (#3661)

This commit is contained in:
Martin Delille 2019-08-17 22:19:16 +02:00 committed by sunn
parent 1ce09788a9
commit 024f46814c
4 changed files with 21 additions and 21 deletions

View File

@ -102,7 +102,7 @@ void
} }
} }
{{/collectionFormat}}{{/queryParams}} {{/collectionFormat}}{{/queryParams}}
{{prefix}}HttpRequestWorker *worker = new {{prefix}}HttpRequestWorker(); {{prefix}}HttpRequestWorker *worker = new {{prefix}}HttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
{{prefix}}HttpRequestInput input(fullPath, "{{httpMethod}}"); {{prefix}}HttpRequestInput input(fullPath, "{{httpMethod}}");
{{#formParams}} {{#formParams}}

View File

@ -56,7 +56,7 @@ OAIPetApi::addPet(const OAIPet& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/pet"); fullPath.append(this->host).append(this->basePath).append("/pet");
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "POST"); OAIHttpRequestInput input(fullPath, "POST");
@ -108,7 +108,7 @@ OAIPetApi::deletePet(const qint64& pet_id, const QString& api_key) {
pet_idPathParam.append("petId").append("}"); pet_idPathParam.append("petId").append("}");
fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id))); fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "DELETE"); OAIHttpRequestInput input(fullPath, "DELETE");
@ -196,7 +196,7 @@ OAIPetApi::findPetsByStatus(const QList<QString>& status) {
} }
} }
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "GET"); OAIHttpRequestInput input(fullPath, "GET");
@ -291,7 +291,7 @@ OAIPetApi::findPetsByTags(const QList<QString>& tags) {
} }
} }
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "GET"); OAIHttpRequestInput input(fullPath, "GET");
@ -349,7 +349,7 @@ OAIPetApi::getPetById(const qint64& pet_id) {
pet_idPathParam.append("petId").append("}"); pet_idPathParam.append("petId").append("}");
fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id))); fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "GET"); OAIHttpRequestInput input(fullPath, "GET");
@ -395,7 +395,7 @@ OAIPetApi::updatePet(const OAIPet& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/pet"); fullPath.append(this->host).append(this->basePath).append("/pet");
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "PUT"); OAIHttpRequestInput input(fullPath, "PUT");
@ -447,7 +447,7 @@ OAIPetApi::updatePetWithForm(const qint64& pet_id, const QString& name, const QS
pet_idPathParam.append("petId").append("}"); pet_idPathParam.append("petId").append("}");
fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id))); fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "POST"); OAIHttpRequestInput input(fullPath, "POST");
if (name != nullptr) { if (name != nullptr) {
@ -501,7 +501,7 @@ OAIPetApi::uploadFile(const qint64& pet_id, const QString& additional_metadata,
pet_idPathParam.append("petId").append("}"); pet_idPathParam.append("petId").append("}");
fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id))); fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "POST"); OAIHttpRequestInput input(fullPath, "POST");
if (additional_metadata != nullptr) { if (additional_metadata != nullptr) {

View File

@ -59,7 +59,7 @@ OAIStoreApi::deleteOrder(const QString& order_id) {
order_idPathParam.append("orderId").append("}"); order_idPathParam.append("orderId").append("}");
fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(order_id))); fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(order_id)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "DELETE"); OAIHttpRequestInput input(fullPath, "DELETE");
@ -104,7 +104,7 @@ OAIStoreApi::getInventory() {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/store/inventory"); fullPath.append(this->host).append(this->basePath).append("/store/inventory");
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "GET"); OAIHttpRequestInput input(fullPath, "GET");
@ -162,7 +162,7 @@ OAIStoreApi::getOrderById(const qint64& order_id) {
order_idPathParam.append("orderId").append("}"); order_idPathParam.append("orderId").append("}");
fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(order_id))); fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(order_id)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "GET"); OAIHttpRequestInput input(fullPath, "GET");
@ -208,7 +208,7 @@ OAIStoreApi::placeOrder(const OAIOrder& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/store/order"); fullPath.append(this->host).append(this->basePath).append("/store/order");
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "POST"); OAIHttpRequestInput input(fullPath, "POST");

View File

@ -56,7 +56,7 @@ OAIUserApi::createUser(const OAIUser& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/user"); fullPath.append(this->host).append(this->basePath).append("/user");
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "POST"); OAIHttpRequestInput input(fullPath, "POST");
@ -105,7 +105,7 @@ OAIUserApi::createUsersWithArrayInput(const QList<OAIUser>& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/user/createWithArray"); fullPath.append(this->host).append(this->basePath).append("/user/createWithArray");
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "POST"); OAIHttpRequestInput input(fullPath, "POST");
@ -155,7 +155,7 @@ OAIUserApi::createUsersWithListInput(const QList<OAIUser>& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/user/createWithList"); fullPath.append(this->host).append(this->basePath).append("/user/createWithList");
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "POST"); OAIHttpRequestInput input(fullPath, "POST");
@ -208,7 +208,7 @@ OAIUserApi::deleteUser(const QString& username) {
usernamePathParam.append("username").append("}"); usernamePathParam.append("username").append("}");
fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username))); fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "DELETE"); OAIHttpRequestInput input(fullPath, "DELETE");
@ -256,7 +256,7 @@ OAIUserApi::getUserByName(const QString& username) {
usernamePathParam.append("username").append("}"); usernamePathParam.append("username").append("}");
fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username))); fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "GET"); OAIHttpRequestInput input(fullPath, "GET");
@ -318,7 +318,7 @@ OAIUserApi::loginUser(const QString& username, const QString& password) {
.append("=") .append("=")
.append(QUrl::toPercentEncoding(::OpenAPI::toStringValue(password))); .append(QUrl::toPercentEncoding(::OpenAPI::toStringValue(password)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "GET"); OAIHttpRequestInput input(fullPath, "GET");
@ -365,7 +365,7 @@ OAIUserApi::logoutUser() {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/user/logout"); fullPath.append(this->host).append(this->basePath).append("/user/logout");
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "GET"); OAIHttpRequestInput input(fullPath, "GET");
@ -413,7 +413,7 @@ OAIUserApi::updateUser(const QString& username, const OAIUser& body) {
usernamePathParam.append("username").append("}"); usernamePathParam.append("username").append("}");
fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username))); fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(this);
worker->setTimeOut(timeout); worker->setTimeOut(timeout);
OAIHttpRequestInput input(fullPath, "PUT"); OAIHttpRequestInput input(fullPath, "PUT");