forked from loafle/openapi-generator-original
[C][Client] Fix the memory leak when a JSON string of model fails to parse. (#8390)
This commit is contained in:
parent
f136b9fd01
commit
0284fcd5c7
@ -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;
|
||||
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
5.0.0-SNAPSHOT
|
||||
5.0.1-SNAPSHOT
|
@ -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;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user