File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
cpp/ql/test/query-tests/jsf/4.10 Classes/AV Rule 79 Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 2222| Variants.cpp:69:3:69:17 | ... = ... | Resource a is acquired by class MyClass6 but not released anywhere in this class. |
2323| Variants.cpp:70:3:70:36 | ... = ... | Resource b is acquired by class MyClass6 but not released anywhere in this class. |
2424| Variants.cpp:71:3:71:41 | ... = ... | Resource c is acquired by class MyClass6 but not released anywhere in this class. |
25+ | Variants.cpp:72:3:72:22 | ... = ... | Resource d is acquired by class MyClass6 but not released anywhere in this class. |
2526| Wrapped.cpp:46:3:46:22 | ... = ... | Resource ptr2 is acquired by class Wrapped2 but not released anywhere in this class. |
2627| Wrapped.cpp:59:3:59:22 | ... = ... | Resource ptr4 is acquired by class Wrapped2 but not released anywhere in this class. |
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ void *malloc(size_t size);
55void *calloc (size_t nmemb, size_t size);
66void *realloc (void *ptr, size_t size);
77void free (void * ptr);
8-
8+ char * strdup ( const char *s1);
99
1010int *ID (int *x)
1111{
@@ -46,19 +46,19 @@ class MyClass5
4646 a = new int [10 ]; // GOOD
4747 b = (int *)calloc (10 , sizeof (int )); // GOOD
4848 c = (int *)realloc (0 , 10 * sizeof (int )); // GOOD
49-
49+ d = strdup ( " string " );
5050 }
5151
5252 ~MyClass5 ()
5353 {
5454 delete [] a;
5555 free (b);
5656 free (c);
57-
57+ free (d);
5858 }
5959
6060 int *a, *b, *c;
61-
61+ char *d;
6262};
6363
6464class MyClass6
@@ -69,15 +69,15 @@ class MyClass6
6969 a = new int [10 ]; // BAD
7070 b = (int *)calloc (10 , sizeof (int )); // BAD
7171 c = (int *)realloc (0 , 10 * sizeof (int )); // BAD
72-
72+ d = strdup ( " string " ); // BAD
7373 }
7474
7575 ~MyClass6 ()
7676 {
7777 }
7878
7979 int *a, *b, *c;
80-
80+ char *d;
8181};
8282
8383class MyClass7
You can’t perform that action at this time.
0 commit comments