Skip to content

Commit

Permalink
Fixed bug 2657 - Memory leak in GL_CreateTexture function
Browse files Browse the repository at this point in the history
Nitz

In GL_CreateTexture function:

if (GL_CheckError("glGenTexures()", renderer) < 0) {
        SDL_free(data);
        return -1;
    }

Here only data is getting free but data->pixels getting leak.
So have to free data->pixels before free data.
  • Loading branch information
slouken committed Jul 26, 2014
1 parent 987c335 commit dfc7535
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/render/opengl/SDL_render_gl.c
Expand Up @@ -688,6 +688,9 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
GL_CheckError("", renderer);
renderdata->glGenTextures(1, &data->texture);
if (GL_CheckError("glGenTexures()", renderer) < 0) {
if (data->pixels) {
SDL_free(data->pixels);
}
SDL_free(data);
return -1;
}
Expand Down

0 comments on commit dfc7535

Please sign in to comment.