mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 07:52:48 +00:00
[C][Client] Check the pointer before deleting operation to avoid core dump label:"Client C" (#5626)
* [C-libcurl] Check the pointer before deleting operation to avoid core dump * [C-libcurl] Check the pointer before deleting operation, update sample
This commit is contained in:
@@ -88,8 +88,10 @@ void list_iterateThroughListBackward(list_t *list,
|
||||
}
|
||||
|
||||
void list_free(list_t *list) {
|
||||
list_iterateThroughListForward(list, listEntry_free, NULL);
|
||||
free(list);
|
||||
if(list){
|
||||
list_iterateThroughListForward(list, listEntry_free, NULL);
|
||||
free(list);
|
||||
}
|
||||
}
|
||||
|
||||
void list_addElement(list_t *list, void *dataToAddInList) {
|
||||
|
||||
@@ -205,6 +205,9 @@ char* {{name}}{{classname}}_ToString({{projectName}}_{{classVarName}}_{{enumName
|
||||
|
||||
|
||||
void {{classname}}_free({{classname}}_t *{{classname}}) {
|
||||
if(NULL == {{classname}}){
|
||||
return ;
|
||||
}
|
||||
listEntry_t *listEntry;
|
||||
{{#vars}}
|
||||
{{^isContainer}}
|
||||
|
||||
Reference in New Issue
Block a user