-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C] report by Clang Static Analyzer #7221
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
Hi @wing328 @zhemant @michelealbano I'd like to address some fixes.
|
Hi @wing328 @zhemant @michelealbano I reviewed all cases of memory leak in model/*.c and think they are false alarms. Take the below case as an example:
pet_local_var = pet_create ( //← Potential memory leak
id ? id->valuedouble : 0,
category ? category_local_nonprim : NULL,
strdup(name->valuestring),
photo_urlsList,
tags ? tagsList : NULL,
status ? statusVariable : -1
);
return pet_local_var; //<-- pet_local_var is returned and may memory-leak The openapi c client only allocates the memory of model (e.g. pet), returns to user to use. e.g. (in unit-tests/manual-PetAPI.c) pet_t *pet = pet_create(EXAMPLE_PET_ID,
category,
petName,
photoUrls,
tags,
status);
...
pet_free(pet); // <-- free the memory here. |
I'm going to address the remaining bugs in api/*.c I think 2 PR will be enought. one is for
And the other one is for
|
There is only one problem remaining:
But I do not understand why the Hi @wing328 @zhemant @michelealbano Do you have any comments about this problem ? |
Hi @wing328 Since there is no more question and comment, I think the bugs reported by this ticket are resolved. |
Attached please find the updated report. |
Thank you @wing328 4 new problems are reported by this time.
|
Thanks @wing328 Could you please re-run the scan of Clang Static Analyzer again ? |
Attached please find the latest report Only 2 issues remaining 👍 |
Hi @wing328 The detail of remaining issues are described above, I think they are false alarm. So there is no issues reported by CSA scan actually now.
|
Attached please find the new report created a few minutes ago. |
There is no new issue found by the dec16report. The 2 issues are false-alarm we have analyzed at above comments.
|
I used Clang Static Analyzer to detect potential issues with the client and got a report like the following:
Attached is the full report (unzip and open index.html in the browser).
scan-build-report.zip
We'll review and address these issues with separate PRs.
If anyone wants to help, please reply to let us know.
cc @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03)
The text was updated successfully, but these errors were encountered: