Mesa (master): virgl: free sampler view on failure path
Dave Airlie
airlied at kemper.freedesktop.org
Sat Oct 31 06:17:04 UTC 2015
Module: Mesa
Branch: master
Commit: 8d731ebd33211d8b9c108fa60bfc854b2a8464c5
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d731ebd33211d8b9c108fa60bfc854b2a8464c5
Author: Dave Airlie <airlied at gmail.com>
Date: Sat Oct 31 16:07:52 2015 +1000
virgl: free sampler view on failure path
Reported by Coverity.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/gallium/drivers/virgl/virgl_context.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c
index cae6352..e4f02ba 100644
--- a/src/gallium/drivers/virgl/virgl_context.c
+++ b/src/gallium/drivers/virgl/virgl_context.c
@@ -665,13 +665,17 @@ static struct pipe_sampler_view *virgl_create_sampler_view(struct pipe_context *
const struct pipe_sampler_view *state)
{
struct virgl_context *vctx = virgl_context(ctx);
- struct virgl_sampler_view *grview = CALLOC_STRUCT(virgl_sampler_view);
+ struct virgl_sampler_view *grview;
uint32_t handle;
struct virgl_resource *res;
if (state == NULL)
return NULL;
+ grview = CALLOC_STRUCT(virgl_sampler_view);
+ if (!grview)
+ return NULL;
+
res = virgl_resource(texture);
handle = virgl_object_assign_handle();
virgl_encode_sampler_view(vctx, handle, res, state);
More information about the mesa-commit
mailing list