From: Emil Velikov Date: Sat, 17 Aug 2013 20:45:19 +0000 (+0100) Subject: st/xvmc: exit gracefully if we fail to create video buffer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eab9bad1ac0e0ba625b750ee2fbe557beb336766;p=mesa.git st/xvmc: exit gracefully if we fail to create video buffer Free any allocated memory and return BadAlloc if create_video_buffer() has failed to create a buffer. Reviewed-by: Christian König Signed-off-by: Emil Velikov --- diff --git a/src/gallium/state_trackers/xvmc/surface.c b/src/gallium/state_trackers/xvmc/surface.c index 2e67612f690..13f337c61cd 100644 --- a/src/gallium/state_trackers/xvmc/surface.c +++ b/src/gallium/state_trackers/xvmc/surface.c @@ -193,6 +193,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);