Skip to content

Commit 0c3e2b9

Browse files
authored
Update test.c
1 parent c31a761 commit 0c3e2b9

File tree

1 file changed

+6
-6
lines changed
  • cpp/ql/test/experimental/query-tests/Security/CWE/CWE-415/semmle/tests

1 file changed

+6
-6
lines changed

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-415/semmle/tests/test.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff 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
}
2828
void 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
}
3939
void 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
}
7272
void workFunction_7(char *s) {
7373
int intSize = 10;

0 commit comments

Comments
 (0)