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