summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/vdpau/bitmap.c
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-01-17 22:25:34 -0500
committerIlia Mirkin <[email protected]>2014-01-19 20:02:10 -0500
commit813ce219c87bd40ebee1cd170b792e11971cb01d (patch)
tree8aa33e9b0db71cb934b0b34f14adf0a47836a41d /src/gallium/state_trackers/vdpau/bitmap.c
parent00e4314f6d605e467b9a386cacab7eec48b9e429 (diff)
st/vdpau: fix bogus error handling in output/bitmap creation
Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/vdpau/bitmap.c')
-rw-r--r--src/gallium/state_trackers/vdpau/bitmap.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/gallium/state_trackers/vdpau/bitmap.c b/src/gallium/state_trackers/vdpau/bitmap.c
index 2d69ead221a..87def5042eb 100644
--- a/src/gallium/state_trackers/vdpau/bitmap.c
+++ b/src/gallium/state_trackers/vdpau/bitmap.c
@@ -45,6 +45,7 @@ vlVdpBitmapSurfaceCreate(VdpDevice device,
struct pipe_context *pipe;
struct pipe_resource res_tmpl, *res;
struct pipe_sampler_view sv_templ;
+ VdpStatus ret;
vlVdpBitmapSurface *vlsurface = NULL;
@@ -81,30 +82,37 @@ vlVdpBitmapSurfaceCreate(VdpDevice device,
pipe_mutex_lock(dev->mutex);
res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!res) {
- pipe_mutex_unlock(dev->mutex);
- FREE(dev);
- FREE(vlsurface);
- return VDP_STATUS_RESOURCES;
+ ret = VDP_STATUS_RESOURCES;
+ goto err_unlock;
}
vlVdpDefaultSamplerViewTemplate(&sv_templ, res);
vlsurface->sampler_view = pipe->create_sampler_view(pipe, res, &sv_templ);
pipe_resource_reference(&res, NULL);
- pipe_mutex_unlock(dev->mutex);
if (!vlsurface->sampler_view) {
- FREE(dev);
- return VDP_STATUS_RESOURCES;
+ ret = VDP_STATUS_RESOURCES;
+ goto err_unlock;
}
+ pipe_mutex_unlock(dev->mutex);
+
*surface = vlAddDataHTAB(vlsurface);
if (*surface == 0) {
- FREE(dev);
- return VDP_STATUS_ERROR;
+ pipe_mutex_lock(dev->mutex);
+ ret = VDP_STATUS_ERROR;
+ goto err_sampler;
}
return VDP_STATUS_OK;
+
+err_sampler:
+ pipe_sampler_view_reference(&vlsurface->sampler_view, NULL);
+err_unlock:
+ pipe_mutex_unlock(dev->mutex);
+ FREE(vlsurface);
+ return ret;
}
/**