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 with pthread_exit called in main, remove threadid analy…
…sis from params as it is not needed.
- Loading branch information
Showing
5 changed files
with
28 additions
and
6 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
3 changes: 1 addition & 2 deletions
3
tests/regression/76-memleak/09-invalid-memcleanup-multi-threaded-abort.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
2 changes: 1 addition & 1 deletion
2
tests/regression/76-memleak/14-invalid-memcleanup-multi-threaded-betterpiv.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
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
23 changes: 23 additions & 0 deletions
23
tests/regression/76-memleak/16-no-mem-leak-thread-exit-main.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,23 @@ | ||
//PARAM: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak --set ana.activated[+] thread | ||
#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); | ||
|
||
pthread_exit(NULL); | ||
|
||
pthread_join(t1, NULL); | ||
|
||
// A pthread_join called in main will wait for other threads to finish | ||
// Therefore, no memory leak here | ||
return 0; // NOWARN | ||
} |