[Mesa-dev] [PATCH 3/7] st/xvmc: exit gracefully if we fail to create video buffer

Christian König deathsimple at vodafone.de
Sun Aug 18 04:33:10 PDT 2013


Am 17.08.2013 23:51, schrieb Emil Velikov:
> Free any allocated memory and return BadAlloc if create_video_buffer()
> has failed to create a buffer.
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   src/gallium/state_trackers/xvmc/surface.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/src/gallium/state_trackers/xvmc/surface.c b/src/gallium/state_trackers/xvmc/surface.c
> index 6a895aa..25b646a 100644
> --- a/src/gallium/state_trackers/xvmc/surface.c
> +++ b/src/gallium/state_trackers/xvmc/surface.c
> @@ -191,6 +191,10 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac
>      );
>   
>      surface_priv->video_buffer = pipe->create_video_buffer(pipe, &tmpl);
> +   if (!surface_priv->video_buffer) {
> +      FREE(surface_priv);
> +      return BadAlloc;
> +   }
>      surface_priv->context = context;
>   
>      surface->surface_id = XAllocID(dpy);



More information about the mesa-dev mailing list