crocus: Use ralloc_free for memory allocated with rzalloc
authorMichel Dänzer <mdaenzer@redhat.com>
Tue, 7 Mar 2023 17:14:57 +0000 (18:14 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 17 Mar 2023 16:08:33 +0000 (16:08 +0000)
Pointed out by GCC with LTO:

../src/gallium/drivers/crocus/crocus_context.c: In function 'crocus_create_context':
../src/gallium/drivers/crocus/crocus_context.c:261:7: error: 'free' called on pointer 'block_174' with nonzero offset 48 [-Werror=free-nonheap-object]
  261 |       free(ctx);
      |       ^

v2:
* Use ice pointer instead of ctx. (Karol Herbst)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21781>

src/gallium/drivers/crocus/crocus_context.c

index 77ddb2e..56e4810 100644 (file)
@@ -258,7 +258,7 @@ crocus_create_context(struct pipe_screen *pscreen, void *priv, unsigned flags)
 
    ctx->stream_uploader = u_upload_create_default(ctx);
    if (!ctx->stream_uploader) {
-      free(ctx);
+      ralloc_free(ice);
       return NULL;
    }
    ctx->const_uploader = ctx->stream_uploader;