Closed trofi closed 10 months ago
gcc-14 added a new -Walloc-size warning that makes sure that size of an individual element matches size of a pointed type:
gcc-14
-Walloc-size
https://gcc.gnu.org/PR71219
swaybg triggers it on calloc() calls where member size is used as 1 (instead of member count):
swaybg
calloc()
1
../main.c:492:32: error: allocation of insufficient size '1' for type 'struct swaybg_output_config' with size '48' [-Werror=alloc-size] 492 | config = calloc(sizeof(struct swaybg_output_config), 1); | ^
Thanks!
gcc-14
added a new-Walloc-size
warning that makes sure that size of an individual element matches size of a pointed type:swaybg
triggers it oncalloc()
calls where member size is used as1
(instead of member count):