Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Replaced use of malloc()/free() with SDL_malloc()/SDL_free() in test …
Browse files Browse the repository at this point in the history
…program.
  • Loading branch information
philippwiesemann committed Jul 20, 2013
1 parent 1b700da commit 703702e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/testshape.c
Expand Up @@ -79,7 +79,7 @@ int main(int argc,char** argv)
}

num_pictures = argc - 1;
pictures = (LoadedPicture *)malloc(sizeof(LoadedPicture)*num_pictures);
pictures = (LoadedPicture *)SDL_malloc(sizeof(LoadedPicture)*num_pictures);
for(i=0;i<num_pictures;i++)
pictures[i].surface = NULL;
for(i=0;i<num_pictures;i++) {
Expand All @@ -89,7 +89,7 @@ int main(int argc,char** argv)
for(j=0;j<num_pictures;j++)
if(pictures[j].surface != NULL)
SDL_FreeSurface(pictures[j].surface);
free(pictures);
SDL_free(pictures);
SDL_VideoQuit();
printf("Could not load surface from named bitmap file.\n");
exit(-3);
Expand All @@ -110,7 +110,7 @@ int main(int argc,char** argv)
if(window == NULL) {
for(i=0;i<num_pictures;i++)
SDL_FreeSurface(pictures[i].surface);
free(pictures);
SDL_free(pictures);
SDL_VideoQuit();
printf("Could not create shaped window for SDL_Shape.\n");
exit(-4);
Expand All @@ -120,7 +120,7 @@ int main(int argc,char** argv)
SDL_DestroyWindow(window);
for(i=0;i<num_pictures;i++)
SDL_FreeSurface(pictures[i].surface);
free(pictures);
SDL_free(pictures);
SDL_VideoQuit();
printf("Could not create rendering context for SDL_Shape window.\n");
exit(-5);
Expand All @@ -137,7 +137,7 @@ int main(int argc,char** argv)
SDL_DestroyTexture(pictures[i].texture);
for(i=0;i<num_pictures;i++)
SDL_FreeSurface(pictures[i].surface);
free(pictures);
SDL_free(pictures);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_VideoQuit();
Expand Down Expand Up @@ -194,7 +194,7 @@ int main(int argc,char** argv)
//Free the original surfaces backing the textures.
for(i=0;i<num_pictures;i++)
SDL_FreeSurface(pictures[i].surface);
free(pictures);
SDL_free(pictures);
//Call SDL_VideoQuit() before quitting.
SDL_VideoQuit();

Expand Down

0 comments on commit 703702e

Please sign in to comment.