mirror of https://github.com/encounter/SDL.git
Fix potential memory leak in GLES_CreateTexture
This commit is contained in:
parent
301912a5b9
commit
00b67f5572
|
@ -359,6 +359,9 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
renderdata->glGenTextures(1, &data->texture);
|
renderdata->glGenTextures(1, &data->texture);
|
||||||
result = renderdata->glGetError();
|
result = renderdata->glGetError();
|
||||||
if (result != GL_NO_ERROR) {
|
if (result != GL_NO_ERROR) {
|
||||||
|
if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
|
||||||
|
SDL_free(data->pixels);
|
||||||
|
}
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
return GLES_SetError("glGenTextures()", result);
|
return GLES_SetError("glGenTextures()", result);
|
||||||
}
|
}
|
||||||
|
@ -387,6 +390,9 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
|
|
||||||
result = renderdata->glGetError();
|
result = renderdata->glGetError();
|
||||||
if (result != GL_NO_ERROR) {
|
if (result != GL_NO_ERROR) {
|
||||||
|
if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
|
||||||
|
SDL_free(data->pixels);
|
||||||
|
}
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
return GLES_SetError("glTexImage2D()", result);
|
return GLES_SetError("glTexImage2D()", result);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue