Skip to content

Commit

Permalink
[C][Client][Clang Static Analyzer] Fix memory leak before function re…
Browse files Browse the repository at this point in the history
…turnning (#7302)
  • Loading branch information
ityuhui authored Aug 27, 2020
1 parent 11a674f commit f11b2e6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ end:
{{/formParams}}
return elementToReturn;
end:
free(localVarPath);
return NULL;
{{/returnType}}
{{^returnType}}
Expand Down
4 changes: 4 additions & 0 deletions samples/client/petstore/c/api/PetAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ PetAPI_findPetsByStatus(apiClient_t *apiClient, list_t * status )
free(localVarPath);
return elementToReturn;
end:
free(localVarPath);
return NULL;

}
Expand Down Expand Up @@ -352,6 +353,7 @@ PetAPI_findPetsByTags(apiClient_t *apiClient, list_t * tags )
free(localVarPath);
return elementToReturn;
end:
free(localVarPath);
return NULL;

}
Expand Down Expand Up @@ -435,6 +437,7 @@ PetAPI_getPetById(apiClient_t *apiClient, long petId )
free(localVarToReplace_petId);
return elementToReturn;
end:
free(localVarPath);
return NULL;

}
Expand Down Expand Up @@ -702,6 +705,7 @@ PetAPI_uploadFile(apiClient_t *apiClient, long petId , char * additionalMetadata
free(keyPairForm_file);
return elementToReturn;
end:
free(localVarPath);
return NULL;

}
Expand Down
3 changes: 3 additions & 0 deletions samples/client/petstore/c/api/StoreAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ StoreAPI_getInventory(apiClient_t *apiClient)
free(localVarPath);
return elementToReturn;
end:
free(localVarPath);
return NULL;

}
Expand Down Expand Up @@ -217,6 +218,7 @@ StoreAPI_getOrderById(apiClient_t *apiClient, long orderId )
free(localVarToReplace_orderId);
return elementToReturn;
end:
free(localVarPath);
return NULL;

}
Expand Down Expand Up @@ -291,6 +293,7 @@ StoreAPI_placeOrder(apiClient_t *apiClient, order_t * body )
free(localVarBodyParameters);
return elementToReturn;
end:
free(localVarPath);
return NULL;

}
Expand Down
2 changes: 2 additions & 0 deletions samples/client/petstore/c/api/UserAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ UserAPI_getUserByName(apiClient_t *apiClient, char * username )
free(localVarToReplace_username);
return elementToReturn;
end:
free(localVarPath);
return NULL;

}
Expand Down Expand Up @@ -477,6 +478,7 @@ UserAPI_loginUser(apiClient_t *apiClient, char * username , char * password )
}
return elementToReturn;
end:
free(localVarPath);
return NULL;

}
Expand Down

0 comments on commit f11b2e6

Please sign in to comment.