Skip to content

Commit

Permalink
Add two simple regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrstanb committed Aug 4, 2023
1 parent 9cea9fb commit 3573182
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/regression/76-memleak/01-simple-no-mem-leak.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//PARAM: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak
#include <stdlib.h>

int main(int argc, char const *argv[]) {
int *p = malloc(sizeof(int));
free(p);

return 0; //NOWARN
}
8 changes: 8 additions & 0 deletions tests/regression/76-memleak/02-simple-mem-leak.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//PARAM: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak
#include <stdlib.h>

int main(int argc, char const *argv[]) {
int *p = malloc(sizeof(int));
// No free => memory is leaked
return 0; //TODO: `make test` detects OTHER and not WARN here
}

0 comments on commit 3573182

Please sign in to comment.