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.
Add test case for memory leaking from a thead that is not joined, add…
… thread_joins to other test cases.
- Loading branch information
Showing
4 changed files
with
32 additions
and
4 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
18 changes: 18 additions & 0 deletions
18
tests/regression/76-memleak/15-mem-leak-not-joined-thread.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,18 @@ | ||
//PARAM: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak --set ana.activated[+] thread --set ana.activated[+] threadid | ||
#include <stdlib.h> | ||
#include <pthread.h> | ||
|
||
int *m1; | ||
|
||
void *f1(void *arg) { | ||
m1 = malloc(sizeof(int)); | ||
while (1); | ||
} | ||
|
||
int main(int argc, char const *argv[]) { | ||
pthread_t t1; | ||
pthread_create(&t1, NULL, f1, NULL); | ||
|
||
// memory from thread f1 which was not joined into main, is not freed | ||
return 0; //WARN | ||
} |