int test4() { int *data = (int*)my_malloc2(1, 4); my_free1(data); data = (int *)my_malloc2(1, 4); my_free1(data); return *data; // expected-warning {{Use of memory after it is freed}} }
void addSet(Set* l, int id) { Set nouveau = my_malloc2(sizeof(struct _Set)); nouveau->id = id; nouveau->queue = *l; *l = nouveau; }
void addCoor(Coor* l, int id ,int x,int y) { if ( *l != NULL && id == (*l)->id) { return; } Coor nouveau = my_malloc2(sizeof(struct _Coor)); nouveau->x = x; nouveau->y = y; nouveau->id = id; nouveau->queue = *l; *l = nouveau; }
Data setGscore(int id , int val , Data l) { Data p = l; while ( p != NULL ) { if ( p->id == id) { p->g = val; return l; } p = p->queue; } Data nouveau = my_malloc2(sizeof( struct _Data)); nouveau->id = id; nouveau->g =val; nouveau->queue = l; return nouveau; }
Came setCameFrom( int id , int val , Came l) { Came p = l; while ( p != NULL ) { if ( p->id == id) { p->valIdCame = val; return l; } p = p->queue; } Came nouveau = my_malloc2(sizeof( struct _Came)); nouveau->id = id; nouveau->valIdCame =val; nouveau->queue = l; return nouveau; }
void n2af1() { int *p = my_malloc2(12); return; // expected-warning{{Allocated memory never released. Potential memory leak.}} }
void n2af1() { int *p = my_malloc2(12); return; // expected-warning{{Memory is never released; potential leak}} }
void n2af1() { int *p = my_malloc2(12); return; // expected-warning{{Potential leak of memory pointed to by}} }
void test6() { int *data = (int *)my_malloc2(1, 4); my_free1((int*)data); my_free1((int*)data); // expected-warning{{Use of memory after it is freed}} }
static void test3() { void *data = my_malloc2(1, 4); free(data); data = my_malloc2(1, 4); free(data); }
static void testUniqueingByallocationSiteInTopLevelFunction() { void *data = my_malloc2(1, 4); data = 0; int x = 5;// expected-warning {{Memory is never released; potential leak of memory pointed to by 'data'}} data = my_malloc2(1, 4);// expected-warning {{Memory is never released; potential leak of memory pointed to by 'data'}} }