| Issue |
177558
|
| Summary |
How to perform correct checks for a reference counted dynamic memory api in C
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
fwh-dc
|
Hi,
I am experimenting in using CSA on the OpenSSL codebase. Particularly I am interested in checking memory leaks, null ptr dereferences, etc.
Regarding memory leaks I was testing the use of annotations, but I get false positives because there are no annotations that supports the concept of reference counted dynamically allocated memory.
Example:
```
int main() {
EVP_CIPHER *cipher = EVP_CIPHER_new();
if (!EVP_CIPHER_up_ref(cipher))
EVP_CIPHER_free(cipher);
...
EVP_CIPHER_free(cipher);
EVP_CIPHER_free(cipher);
}
```
This will report a double free, but is actually correct code.
What is the best way to support such api's? Is it adding an attribute or defining a checker? Can I contribute such checks or would I have to maintain it outside the LLVM codebase?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs