mesa: s/malloc/calloc/ to silence a warning
authorAdam Jackson <ajax@redhat.com>
Thu, 6 May 2021 17:26:10 +0000 (13:26 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 6 May 2021 21:25:47 +0000 (21:25 +0000)
commit90cbab7cae5b6fda5646a8037bff6e66a3c73d66
tree1c438e587b770a950d8792a7f1e806ce124bbc77
parent4770d6c01da03c2618825a7f93783a73de9e609d
mesa: s/malloc/calloc/ to silence a warning

gcc 11 warns:

[846/1506] Compiling C object src/mesa/libmesa_common.a.p/main_shaderapi.c.o
In function ‘shader_source’,
    inlined from ‘_mesa_ShaderSource_no_error’ at ../src/mesa/main/shaderapi.c:2137:4:
../src/mesa/main/shaderapi.c:2095:25: warning: ‘*offsets_10 + _130’ may be used uninitialized [-Wmaybe-uninitialized]
 2095 |    totalLength = offsets[count - 1] + 2;

I can't really see how it's getting to that conclusion, but allocating
`offsets` with calloc is both natural to do here and guarantees
initialization.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10671>
src/mesa/main/shaderapi.c