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) {
2323 buf = (char * ) malloc (intSize );
2424 free (buf ); // GOOD
2525 buf = NULL ;
26- free (buf );
26+ free (buf ); // GOOD
2727}
2828void workFunction_3 (char * s ) {
2929 int intSize = 10 ;
3030 char * buf ;
3131 int intFlag ;
3232 buf = (char * ) malloc (intSize );
3333 if (buf [1 ]%5 ) {
34- free (buf );
34+ free (buf ); // GOOD
3535 buf = NULL ;
3636 }
37- free (buf );
37+ free (buf ); // GOOD
3838}
3939void workFunction_4 (char * s ) {
4040 int intSize = 10 ;
@@ -52,7 +52,7 @@ void workFunction_5(char *s) {
5252 int intFlag ;
5353 buf = (char * ) malloc (intSize );
5454 if (intFlag ) {
55- free (buf );
55+ free (buf ); // GOOD
5656 }
5757 free (buf ); // BAD
5858}
@@ -64,10 +64,10 @@ void workFunction_6(char *s) {
6464 tmpbuf = (char * ) malloc (intSize );
6565 buf = (char * ) malloc (intSize );
6666 if (intFlag ) {
67- free (buf );
67+ free (buf ); // GOOD
6868 buf = tmpbuf ;
6969 }
70- free (buf );
70+ free (buf ); // GOOD
7171}
7272void workFunction_7 (char * s ) {
7373 int intSize = 10 ;
You can’t perform that action at this time.
0 commit comments