aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-04-07 07:55:17 +1000
committerTimothy Arceri <[email protected]>2017-04-07 19:48:10 +1000
commit8046a944d084b4ae4e70e61ba50846fd1943247f (patch)
tree92ce6d280ffe3dd5b5c95bcdd60a9cf8998ac02f /src/mesa/swrast
parent1c934bc71b36ec33e59f4b7dc1c7d194585a5bd6 (diff)
mesa: fix renderbuffer leak
We don't need to call _mesa_reference_renderbuffer() for the first assignment as refCount starts at 1. For swrast we work around the fact we will indirectly call _mesa_reference_renderbuffer() by resetting refCount to 0. Fixes: 32141e53d1520 (mesa: tidy up renderbuffer RefCount initialisation) Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_renderbuffer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c
index d8c4ed38638..af09955484e 100644
--- a/src/mesa/swrast/s_renderbuffer.c
+++ b/src/mesa/swrast/s_renderbuffer.c
@@ -271,6 +271,11 @@ add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
return GL_FALSE;
}
+ /* Set refcount to 0 to avoid a leak since the _mesa_add_renderbuffer()
+ * call below will bump the initial refcount.
+ */
+ rb->RefCount = 0;
+
rb->InternalFormat = GL_RGBA;
rb->AllocStorage = soft_renderbuffer_storage;