My function:
Shot *shot_collide(Shot *shot)
{
Shot *moving, *remaining;
remaining=NULL;
moving=shot;
while(moving!=NULL)
{
if(moving->y>658) //ha eléri az alját
{
if(remaining==NULL) //ha ez az első elem
{
shot=moving->next;
free(moving);
moving=shot->next;
}else{
remaining->next=moving->next;
free(moving);
moving=remaining->next;
}
}else{
moving=moving->next;
}
}
return shot;
}
When I call free, i get this error in Xcode:
NHF(1670,0x7fff77e1a300) malloc: * error for object 0x10050c9e0: pointer being freed was >not allocated * set a breakpoint in malloc_error_break to debug
This is an SDL game, and this function is free the shot after it reaches the end of the map.
I gotta finish this to Sunday, but I'm stuck :(

char *p = malloc(10);, then...p++;, then...free(p);you will likely get the error you described. - ryykermovingwas created, assigned a value, then attempted to be freed without ever having calloc or malloc called to assign memory. That simply is the reason for your error message I think. Sorry for the confusion before. - ryyker