Ejemplo n.º 1
0
void *dbg_malloc(int size){
  void *tmp;
  int c;
  int chk;
  chk = 0;
  tmp = malloc(size);
  printf("Malloc: 0x%08x\n", (unsigned int) tmp);

  for(c = 0; c < LIST_SIZE; c++){
    if(dme[c].active == 0){
      if(chk == 0){
	dme[c].ptr = tmp;
	dme[c].size = size;
	dme[c].active = 1;
	chk = 1;
      }
    }else{
      ptr_chk(c,tmp,size);
    }
  }
  return tmp;
}
Ejemplo n.º 2
0
void		spacealiens_destroy(t_spacealiens **aliens)
{
  t_singlelist	*node;
  Uint8		i;

  if (!ptr_chk(*aliens, "aliens", APP_LCAT, "spacealiens_destroy"))
    return ;
  for (i = 0; i < NB_ALIENS_COL; ++i)
  {
    if (!(*aliens)->columns[i])
      continue ;
    for (node = (*aliens)->columns[i]; node; node = node->next)
    {
      if (node->data)
	mem_free(node->data);
      node->data = NULL;
    }
    list_clear(&(*aliens)->columns[i]);
  }
  mem_free(*aliens);
  *aliens = NULL;
}