(GL) Deal with some potential memory leaks
This commit is contained in:
parent
c1b1ff46e0
commit
29e3c79e8b
|
@ -2780,10 +2780,23 @@ unsigned *height_p, size_t *pitch_p)
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
#ifdef HAVE_FBO
|
||||||
if (gl->hw_render_use)
|
if (gl->hw_render_use)
|
||||||
|
{
|
||||||
buffer = malloc(pitch * height);
|
buffer = malloc(pitch * height);
|
||||||
|
if (!buffer)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
buffer_texture = malloc(pitch * gl->tex_h);
|
buffer_texture = malloc(pitch * gl->tex_h);
|
||||||
|
|
||||||
|
if (!buffer_texture)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_FBO
|
||||||
|
if (buffer)
|
||||||
|
free(buffer);
|
||||||
|
#endif
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||||
glGetTexImage(GL_TEXTURE_2D, 0,gl->texture_type, gl->texture_fmt, buffer_texture);
|
glGetTexImage(GL_TEXTURE_2D, 0,gl->texture_type, gl->texture_fmt, buffer_texture);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue