[Mesa-dev] [PATCH] main: create_buffers unlocks mutex when throwing OUT_OF_MEMORY.

Ilia Mirkin imirkin at alum.mit.edu
Wed Apr 1 11:56:25 PDT 2015


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

An alternative, btw, is to do a goto to the existing unlock. This
would have the advantage of keeping a single unlock, and a single
return path in the function. Your call, you get the R-b either way.

  -ilia

On Wed, Apr 1, 2015 at 2:23 PM, Laura Ekstrand <laura at jlekstrand.net> wrote:
> Ilia Mirkin found that I had forgotten to free the mutex in the error case.
> ---
>  src/mesa/main/bufferobj.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index b67e1c4..c7ef90b 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -1353,6 +1353,7 @@ create_buffers(GLsizei n, GLuint *buffers, bool dsa)
>           buf = ctx->Driver.NewBufferObject(ctx, buffers[i]);
>           if (!buf) {
>              _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
> +            mtx_unlock(&ctx->Shared->Mutex);
>              return;
>           }
>        }
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list