Skip to content

Commit

Permalink
Add unsound example
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-schwarz committed Nov 19, 2023
1 parent 720cfee commit af9ddc7
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/regression/76-memleak/10-leak-later.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//PARAM: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak
#include <stdlib.h>
#include <pthread.h>

int *g;
int *m1;
int *m2;

void *f1(void *arg) {
int top;

// Thread t1 leaks m0 here
exit(2); //WARN
}

int main(int argc, char const *argv[]) {
pthread_t t1;
pthread_create(&t1, NULL, f1, NULL);

int* m0 = malloc(sizeof(int));
free(m0);

// main thread is not leaking anything
return 0;
}

0 comments on commit af9ddc7

Please sign in to comment.