SDL_Surface * rotation= rotozoomSurface(image, 10.0, 1, 1); image = rotation; SDL_FreeSurface(rotation);
I know that the problems is in the image=rotation line. I'm fairly certain it is because they are both pointers and thus point to the address in memory of rotation, which is then being assigned to image so they both now point to the same location. That location is then subsequently released. Later when I try to draw to image the memory has been released resulting in the heap corruption error that is thrown. I think that to solve this I need to set image equal to a copy of rotation. However, I do not know how to do that. I am still trying to figure pointers and how they work so if any of the above logic is wrong please let me know. Is this what I need to do/ how do I make a copy?