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 22
22
| Variants.cpp:69:3:69:17 | ... = ... | Resource a is acquired by class MyClass6 but not released anywhere in this class. |
23
23
| Variants.cpp:70:3:70:36 | ... = ... | Resource b is acquired by class MyClass6 but not released anywhere in this class. |
24
24
| 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. |
25
26
| Wrapped.cpp:46:3:46:22 | ... = ... | Resource ptr2 is acquired by class Wrapped2 but not released anywhere in this class. |
26
27
| 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);
5
5
void *calloc (size_t nmemb, size_t size);
6
6
void *realloc (void *ptr, size_t size);
7
7
void free (void * ptr);
8
-
8
+ char * strdup ( const char *s1);
9
9
10
10
int *ID (int *x)
11
11
{
@@ -46,19 +46,19 @@ class MyClass5
46
46
a = new int [10 ]; // GOOD
47
47
b = (int *)calloc (10 , sizeof (int )); // GOOD
48
48
c = (int *)realloc (0 , 10 * sizeof (int )); // GOOD
49
-
49
+ d = strdup ( " string " );
50
50
}
51
51
52
52
~MyClass5 ()
53
53
{
54
54
delete [] a;
55
55
free (b);
56
56
free (c);
57
-
57
+ free (d);
58
58
}
59
59
60
60
int *a, *b, *c;
61
-
61
+ char *d;
62
62
};
63
63
64
64
class MyClass6
@@ -69,15 +69,15 @@ class MyClass6
69
69
a = new int [10 ]; // BAD
70
70
b = (int *)calloc (10 , sizeof (int )); // BAD
71
71
c = (int *)realloc (0 , 10 * sizeof (int )); // BAD
72
-
72
+ d = strdup ( " string " ); // BAD
73
73
}
74
74
75
75
~MyClass6 ()
76
76
{
77
77
}
78
78
79
79
int *a, *b, *c;
80
-
80
+ char *d;
81
81
};
82
82
83
83
class MyClass7
You can’t perform that action at this time.
0 commit comments