mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
CPP: Tests: Rearrange a test prior to changes.
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
// library
|
||||
typedef unsigned int size_t;
|
||||
void *malloc(size_t size);
|
||||
void *calloc(size_t nmemb, size_t size);
|
||||
void *realloc(void *ptr, size_t size);
|
||||
void free(void* ptr);
|
||||
|
||||
struct FILE;
|
||||
@@ -51,6 +53,13 @@ public:
|
||||
|
||||
myFile1 = fopen("file1.txt", "rt"); // GOOD
|
||||
myFile2 = fopen("file2.txt", "rt"); // BAD: not closed in destructor
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
~MyClass()
|
||||
@@ -58,6 +67,7 @@ public:
|
||||
delete myPtr1;
|
||||
free(myPtr3);
|
||||
fclose(myFile1);
|
||||
|
||||
}
|
||||
|
||||
void close()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
| AV Rule 79.cpp:44:3:44:18 | ... = ... | Resource myPtr2 is acquired by class MyClass but not released anywhere in this class. |
|
||||
| AV Rule 79.cpp:46:3:46:37 | ... = ... | Resource myPtr4 is acquired by class MyClass but not released anywhere in this class. |
|
||||
| AV Rule 79.cpp:47:3:47:18 | ... = ... | Resource myPtr5 is acquired by class MyClass but not released in the destructor. It is released from close on line 65, so this function may need to be called from the destructor. |
|
||||
| AV Rule 79.cpp:48:3:48:37 | ... = ... | Resource myPtr6 is acquired by class MyClass but not released in the destructor. It is released from close on line 66, so this function may need to be called from the destructor. |
|
||||
| AV Rule 79.cpp:53:3:53:36 | ... = ... | Resource myFile2 is acquired by class MyClass but not released anywhere in this class. |
|
||||
| AV Rule 79.cpp:46:3:46:18 | ... = ... | Resource myPtr2 is acquired by class MyClass but not released anywhere in this class. |
|
||||
| AV Rule 79.cpp:48:3:48:37 | ... = ... | Resource myPtr4 is acquired by class MyClass but not released anywhere in this class. |
|
||||
| AV Rule 79.cpp:49:3:49:18 | ... = ... | Resource myPtr5 is acquired by class MyClass but not released in the destructor. It is released from close on line 75, so this function may need to be called from the destructor. |
|
||||
| AV Rule 79.cpp:50:3:50:37 | ... = ... | Resource myPtr6 is acquired by class MyClass but not released in the destructor. It is released from close on line 76, so this function may need to be called from the destructor. |
|
||||
| AV Rule 79.cpp:55:3:55:36 | ... = ... | Resource myFile2 is acquired by class MyClass but not released anywhere in this class. |
|
||||
| Container2.cpp:21:3:21:16 | ... = ... | Resource ptr3 is acquired by class Container2<char> but not released anywhere in this class. |
|
||||
| Container2.cpp:21:3:21:16 | ... = ... | Resource ptr3 is acquired by class Container2<int> but not released anywhere in this class. |
|
||||
| DeleteThis.cpp:56:3:56:24 | ... = ... | Resource ptr10 is acquired by class MyClass3 but not released anywhere in this class. |
|
||||
|
||||
Reference in New Issue
Block a user