[Mesa-dev] [PATCH 2/7] st/vdpau: exit gracefully if we fail to create video buffer
Emil Velikov
emil.l.velikov at gmail.com
Sat Aug 17 14:51:10 PDT 2013
Otherwise we risk causing memory corruption.
v2: forgot the mutex_unlock()
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
src/gallium/state_trackers/vdpau/surface.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c
index 1bebe6c..16ad5c4 100644
--- a/src/gallium/state_trackers/vdpau/surface.c
+++ b/src/gallium/state_trackers/vdpau/surface.c
@@ -87,6 +87,12 @@ vlVdpVideoSurfaceCreate(VdpDevice device, VdpChromaType chroma_type,
PIPE_VIDEO_CAP_PREFERS_INTERLACED
);
p_surf->video_buffer = pipe->create_video_buffer(pipe, &p_surf->templat);
+ if (!p_surf->video_buffer) {
+ pipe_mutex_unlock(dev->mutex);
+ ret = VDP_STATUS_RESOURCES;
+ goto inv_device;
+ }
+
vlVdpVideoSurfaceClear(p_surf);
pipe_mutex_unlock(dev->mutex);
--
1.8.3.4
More information about the mesa-dev
mailing list