Skip to content

zink/ntv: Don't call free() on ralloc'd memory

Adam Jackson requested to merge ajax/mesa:ntv-warning-fix into main

Caught this with an LTO build:

[1465/1465] Linking target src/gallium/targets/dri/
In function ‘spirv_shader_delete’,
    inlined from ‘nir_to_spirv’ at ../src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c:3907:7:
../src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c:3916:4: warning: ‘free’ called on pointer ‘block_1394’ with nonzero offset 48 [-Wfree-nonheap-object]
 3916 |    FREE(s);
      |    ^
../src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c: In function ‘nir_to_spirv’:
../src/util/ralloc.c:133:18: note: returned from ‘malloc’
  133 |    void *block = malloc(align64(size + sizeof(ralloc_header),
      |                  ^

Since s->words is allocated on the same ralloc context we can simplify further by freeing the context all at once.

Merge request reports