[Mesa-dev] [PATCH] mesa: remove usage of alloca in externalobjects.c

Emil Velikov emil.l.velikov at gmail.com
Wed Jan 31 17:52:20 UTC 2018


On 31 January 2018 at 17:30, Andres Rodriguez <andresx7 at gmail.com> wrote:
> Don't want an overly large numBufferBarriers/numTextureBarriers to blow
> up the stack.
>
> Suggested-by: Emil Velikov <emil.velikov at collabora.com>
> Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
> ---
Thanks for sorting this Andres.

>  src/mesa/main/externalobjects.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
> index 463debd268..6a248f35a6 100644
> --- a/src/mesa/main/externalobjects.c
> +++ b/src/mesa/main/externalobjects.c
> @@ -727,34 +727,37 @@ _mesa_WaitSemaphoreEXT(GLuint semaphore,
>
>     ASSERT_OUTSIDE_BEGIN_END(ctx);
>
>     semObj = _mesa_lookup_semaphore_object(ctx, semaphore);
>     if (!semObj)
>        return;
>
>     FLUSH_VERTICES(ctx, 0);
>     FLUSH_CURRENT(ctx, 0);
>
> -   bufObjs = alloca(sizeof(struct gl_buffer_object **) * numBufferBarriers);
> +   bufObjs = malloc(sizeof(struct gl_buffer_object **) * numBufferBarriers);
Through the patch, please check for malloc failure and
_mesa_error(OOM)/free if so

-Emil


More information about the mesa-dev mailing list