Skip to content

Commit

Permalink
Fixed bug 2015 - surface getting leak in SDLTest_ScreenShot function
Browse files Browse the repository at this point in the history
Nitz 2013-08-06 03:53:41 UTC

In function SDLTest_ScreenShot() surface pointer getting leak while return
  • Loading branch information
slouken committed Oct 21, 2013
1 parent 8093055 commit 11d38d6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/test/SDL_test_common.c
Expand Up @@ -1154,11 +1154,13 @@ SDLTest_ScreenShot(SDL_Renderer *renderer)
if (SDL_RenderReadPixels(renderer, NULL, surface->format->format,
surface->pixels, surface->pitch) < 0) {
fprintf(stderr, "Couldn't read screen: %s\n", SDL_GetError());
SDL_free(surface);
return;
}

if (SDL_SaveBMP(surface, "screenshot.bmp") < 0) {
fprintf(stderr, "Couldn't save screenshot.bmp: %s\n", SDL_GetError());
SDL_free(surface);
return;
}
}
Expand Down

0 comments on commit 11d38d6

Please sign in to comment.