From 0e35750fdef909ec8bed499f778e0ebc72c61b33 Mon Sep 17 00:00:00 2001 From: Sam James Date: Sun, 5 Nov 2023 21:36:49 +0000 Subject: [PATCH] spa: bluez: fix -Walloc-size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC 14 introduces a new -Walloc-size included in -Wextra which gives: ``` ./pipewire-0.3.84/spa/plugins/bluez5/codec-loader.c:176:14: warning: allocation of insufficient size ‘1’ for type ‘struct impl’ with size ‘1032’ [-Walloc-size] ``` The calloc prototype is: ``` void *calloc(size_t nmemb, size_t size); ``` So, just swap the number of members and size arguments to match the prototype, as we're initialising 1 struct of size `sizeof(struct impl)`. GCC then sees we're not doing anything wrong. Signed-off-by: Sam James --- spa/plugins/bluez5/codec-loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spa/plugins/bluez5/codec-loader.c b/spa/plugins/bluez5/codec-loader.c index 6ac2301e1..3e7e139eb 100644 --- a/spa/plugins/bluez5/codec-loader.c +++ b/spa/plugins/bluez5/codec-loader.c @@ -173,7 +173,7 @@ const struct media_codec * const *load_media_codecs(struct spa_plugin_loader *lo #undef MEDIA_CODEC_FACTORY_LIB }; - impl = calloc(sizeof(struct impl), 1); + impl = calloc(1, sizeof(struct impl)); if (impl == NULL) return NULL;