diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache index 0f9ec305c74..e487cb0f474 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache @@ -803,6 +803,20 @@ fail: return {{classname}}_local_var; end: + {{#vars}} + {{^isContainer}} + {{^isPrimitiveType}} + {{#isModel}} + {{^isEnum}} + if ({{{name}}}_local_nonprim) { + {{complexType}}_free({{{name}}}_local_nonprim); + {{{name}}}_local_nonprim = NULL; + } + {{/isEnum}} + {{/isModel}} + {{/isPrimitiveType}} + {{/isContainer}} + {{/vars}} return NULL; } diff --git a/samples/client/petstore/c/.openapi-generator/VERSION b/samples/client/petstore/c/.openapi-generator/VERSION index d99e7162d01..3fa3b389a57 100644 --- a/samples/client/petstore/c/.openapi-generator/VERSION +++ b/samples/client/petstore/c/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/c/model/pet.c b/samples/client/petstore/c/model/pet.c index 8acdcfa132e..5ee8445640b 100644 --- a/samples/client/petstore/c/model/pet.c +++ b/samples/client/petstore/c/model/pet.c @@ -264,6 +264,10 @@ pet_t *pet_parseFromJSON(cJSON *petJSON){ return pet_local_var; end: + if (category_local_nonprim) { + category_free(category_local_nonprim); + category_local_nonprim = NULL; + } return NULL; }