Free any allocated memory and return BadAlloc if create_video_buffer() has failed to create a buffer.
Reviewed-by: Christian König <christian.koe...@amd.com> Signed-off-by: Emil Velikov <emil.l.veli...@gmail.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 2e67612..13f337c 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); -- 1.8.3.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev