Skip to content

Commit

Permalink
Fixed crash if creating textures failed in testshape program.
Browse files Browse the repository at this point in the history
  • Loading branch information
philippwiesemann committed Jun 2, 2017
1 parent 0039499 commit 850185f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions test/testshape.c
Expand Up @@ -81,7 +81,6 @@ int main(int argc,char** argv)
pictures[i].surface = SDL_LoadBMP(argv[i+1]);
pictures[i].name = argv[i+1];
if(pictures[i].surface == NULL) {
j = 0;
for(j=0;j<num_pictures;j++)
SDL_FreeSurface(pictures[j].surface);
SDL_free(pictures);
Expand Down Expand Up @@ -130,8 +129,7 @@ int main(int argc,char** argv)
for(i=0;i<num_pictures;i++) {
pictures[i].texture = SDL_CreateTextureFromSurface(renderer,pictures[i].surface);
if(pictures[i].texture == NULL) {
j = 0;
for(j=0;j<num_pictures;i++)
for(i=0;i<num_pictures;i++)
if(pictures[i].texture != NULL)
SDL_DestroyTexture(pictures[i].texture);
for(i=0;i<num_pictures;i++)
Expand Down

0 comments on commit 850185f

Please sign in to comment.