forked from goblint/analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/J2000A/analyzer
- Loading branch information
Showing
7 changed files
with
121 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tests/regression/75-invalid_dealloc/01-invalid-dealloc-simple.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <stdlib.h> | ||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
int a; | ||
int *p = &a; | ||
free(p); //WARN | ||
|
||
char b = 'b'; | ||
char *p2 = &b; | ||
free(p2); //WARN | ||
|
||
return 0; | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/regression/75-invalid_dealloc/02-invalid-dealloc-struct.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <stdlib.h> | ||
|
||
typedef struct custom_t { | ||
int x; | ||
int y; | ||
} custom_t; | ||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
custom_t *var; | ||
free(var); //WARN | ||
|
||
return 0; | ||
} |
25 changes: 25 additions & 0 deletions
25
tests/regression/75-invalid_dealloc/03-invalid-dealloc-array.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <stdlib.h> | ||
|
||
typedef struct custom_t { | ||
int x; | ||
int y; | ||
} custom_t; | ||
|
||
#define MAX_SIZE 5000 | ||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
custom_t custom_arr[MAX_SIZE]; | ||
free(custom_arr); //WARN | ||
|
||
int int_arr[MAX_SIZE]; | ||
free(int_arr); //WARN | ||
|
||
char char_arr[MAX_SIZE]; | ||
free(char_arr); //WARN | ||
|
||
char char_arr2[1]; | ||
free(char_arr2); //WARN | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <stdlib.h> | ||
|
||
typedef struct custom_t { | ||
int x; | ||
int y; | ||
} custom_t; | ||
|
||
#define MAX_SIZE 5000 | ||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
custom_t custom_arr[10]; | ||
realloc(custom_arr, MAX_SIZE); //WARN | ||
|
||
int int_arr[100]; | ||
realloc(int_arr, MAX_SIZE); //WARN | ||
|
||
char char_arr[1000]; | ||
realloc(char_arr, MAX_SIZE); //WARN | ||
|
||
char char_arr2[1]; | ||
realloc(char_arr2, MAX_SIZE); //WARN | ||
|
||
return 0; | ||
} |