mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 07:08:04 +02:00
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: 32141e53d1 (mesa: tidy up renderbuffer RefCount initialisation)
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
This commit is contained in:
parent
1c934bc71b
commit
8046a944d0
2 changed files with 6 additions and 1 deletions
|
|
@ -451,7 +451,7 @@ _mesa_update_texture_renderbuffer(struct gl_context *ctx,
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glFramebufferTexture()");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glFramebufferTexture()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_mesa_reference_renderbuffer(&att->Renderbuffer, rb);
|
att->Renderbuffer = rb;
|
||||||
|
|
||||||
/* This can't get called on a texture renderbuffer, so set it to NULL
|
/* This can't get called on a texture renderbuffer, so set it to NULL
|
||||||
* for clarity compared to user renderbuffers.
|
* for clarity compared to user renderbuffers.
|
||||||
|
|
|
||||||
|
|
@ -271,6 +271,11 @@ add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||||
return GL_FALSE;
|
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->InternalFormat = GL_RGBA;
|
||||||
|
|
||||||
rb->AllocStorage = soft_renderbuffer_storage;
|
rb->AllocStorage = soft_renderbuffer_storage;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue