Update test.c

This commit is contained in:
ihsinme
2021-04-27 10:11:32 +03:00
committed by GitHub
parent c31a761750
commit 0c3e2b9ab7

View File

@@ -23,7 +23,7 @@ void workFunction_2(char *s) {
buf = (char *) malloc(intSize);
free(buf); // GOOD
buf = NULL;
free(buf);
free(buf); // GOOD
}
void workFunction_3(char *s) {
int intSize = 10;
@@ -31,10 +31,10 @@ void workFunction_3(char *s) {
int intFlag;
buf = (char *) malloc(intSize);
if(buf[1]%5) {
free(buf);
free(buf); // GOOD
buf = NULL;
}
free(buf);
free(buf); // GOOD
}
void workFunction_4(char *s) {
int intSize = 10;
@@ -52,7 +52,7 @@ void workFunction_5(char *s) {
int intFlag;
buf = (char *) malloc(intSize);
if(intFlag) {
free(buf);
free(buf); // GOOD
}
free(buf); // BAD
}
@@ -64,10 +64,10 @@ void workFunction_6(char *s) {
tmpbuf = (char *) malloc(intSize);
buf = (char *) malloc(intSize);
if(intFlag) {
free(buf);
free(buf); // GOOD
buf = tmpbuf;
}
free(buf);
free(buf); // GOOD
}
void workFunction_7(char *s) {
int intSize = 10;