Пример #1
0
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}}
}
Пример #2
0
void addSet(Set* l, int id)
{
    Set nouveau = my_malloc2(sizeof(struct _Set));

        nouveau->id = id;

        nouveau->queue = *l;
    *l = nouveau;
}
Пример #3
0
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;
}
Пример #4
0
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;
}
Пример #5
0
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;
}
Пример #6
0
void n2af1() {
  int *p = my_malloc2(12);
  return; // expected-warning{{Allocated memory never released. Potential memory leak.}}
}
Пример #7
0
void n2af1() {
  int *p = my_malloc2(12);
  return; // expected-warning{{Memory is never released; potential leak}}
}
Пример #8
0
void n2af1() {
  int *p = my_malloc2(12);
  return; // expected-warning{{Potential leak of memory pointed to by}}
}
Пример #9
0
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}}
}
Пример #10
0
static void test3() {
  void *data = my_malloc2(1, 4);
  free(data);
  data = my_malloc2(1, 4);
  free(data);
}
Пример #11
0
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'}}
}