summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-10-30 10:10:52 -0600
committerBrian Paul <[email protected]>2010-10-30 10:11:37 -0600
commit9c2b4814d0b7dc67777099ea249c09bcf9ee46eb (patch)
tree48d388fd2d7e4f551edd132681601150001c06df /src/mesa/drivers
parent156e955c25ad4acd78d683c4def83769f0bb3ddb (diff)
osmesa: fix renderbuffer memleak in OSMesaMakeCurrent()
Fixes fd.o bug 31128.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 37dc35cbedd..10ba6b79314 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1327,10 +1327,12 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
* that converts rendering from CHAN_BITS to the user-requested channel
* size.
*/
- osmesa->rb = new_osmesa_renderbuffer(&osmesa->mesa, osmesa->format, type);
- _mesa_remove_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT);
- _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT, osmesa->rb);
- assert(osmesa->rb->RefCount == 2);
+ if (!osmesa->rb) {
+ osmesa->rb = new_osmesa_renderbuffer(&osmesa->mesa, osmesa->format, type);
+ _mesa_remove_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT);
+ _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT, osmesa->rb);
+ assert(osmesa->rb->RefCount == 2);
+ }
/* Set renderbuffer fields. Set width/height = 0 to force
* osmesa_renderbuffer_storage() being called by _mesa_resize_framebuffer()