Mesa (master): gallium/cso: avoid unnecessary null dereference

Emil Velikov evelikov at kemper.freedesktop.org
Wed Aug 24 11:10:14 UTC 2016


Module: Mesa
Branch: master
Commit: 9411eb67ecebfc76c909ca81b09e6e7fe08ac8eb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9411eb67ecebfc76c909ca81b09e6e7fe08ac8eb

Author: Eric Engestrom <eric at engestrom.ch>
Date:   Tue Jul 12 22:48:28 2016 +0100

gallium/cso: avoid unnecessary null dereference

The label `out:` calls `destroy()` which dereferences `ctx`.
This is unnecessary as there is nothing to destroy.
Immediately return instead.

CovID: 1258255
Signed-off-by: Eric Engestrom <eric at engestrom.ch>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/auxiliary/cso_cache/cso_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index b84d599..4a54cff 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -251,7 +251,7 @@ struct cso_context *cso_create_context( struct pipe_context *pipe )
 {
    struct cso_context *ctx = CALLOC_STRUCT(cso_context);
    if (!ctx)
-      goto out;
+      return NULL;
 
    ctx->cache = cso_cache_create();
    if (ctx->cache == NULL)




More information about the mesa-commit mailing list