File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
cpp/ql/test/experimental/query-tests/Security/CWE/CWE-415/semmle/tests Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -23,18 +23,18 @@ void workFunction_2(char *s) {
23
23
buf = (char * ) malloc (intSize );
24
24
free (buf ); // GOOD
25
25
buf = NULL ;
26
- free (buf );
26
+ free (buf ); // GOOD
27
27
}
28
28
void workFunction_3 (char * s ) {
29
29
int intSize = 10 ;
30
30
char * buf ;
31
31
int intFlag ;
32
32
buf = (char * ) malloc (intSize );
33
33
if (buf [1 ]%5 ) {
34
- free (buf );
34
+ free (buf ); // GOOD
35
35
buf = NULL ;
36
36
}
37
- free (buf );
37
+ free (buf ); // GOOD
38
38
}
39
39
void workFunction_4 (char * s ) {
40
40
int intSize = 10 ;
@@ -52,7 +52,7 @@ void workFunction_5(char *s) {
52
52
int intFlag ;
53
53
buf = (char * ) malloc (intSize );
54
54
if (intFlag ) {
55
- free (buf );
55
+ free (buf ); // GOOD
56
56
}
57
57
free (buf ); // BAD
58
58
}
@@ -64,10 +64,10 @@ void workFunction_6(char *s) {
64
64
tmpbuf = (char * ) malloc (intSize );
65
65
buf = (char * ) malloc (intSize );
66
66
if (intFlag ) {
67
- free (buf );
67
+ free (buf ); // GOOD
68
68
buf = tmpbuf ;
69
69
}
70
- free (buf );
70
+ free (buf ); // GOOD
71
71
}
72
72
void workFunction_7 (char * s ) {
73
73
int intSize = 10 ;
You can’t perform that action at this time.
0 commit comments