From 14ef37063f98786fcf4d5e81181c278a8000ea55 Mon Sep 17 00:00:00 2001 From: Sam James Date: Sun, 5 Nov 2023 21:50:05 +0000 Subject: [PATCH] flac: foreign_metadata: 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: ``` src/flac/foreign_metadata.c:803:33: warning: allocation of insufficient size ‘1’ for type ‘foreign_metadata_t’ with size ‘64’ [-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(foreign_metadata_t)`. GCC then sees we're not doing anything wrong. Signed-off-by: Sam James --- src/flac/foreign_metadata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flac/foreign_metadata.c b/src/flac/foreign_metadata.c index f63fc3e60a..ab6644c301 100644 --- a/src/flac/foreign_metadata.c +++ b/src/flac/foreign_metadata.c @@ -800,7 +800,7 @@ static FLAC__bool compare_with_iff_(foreign_metadata_t *fm, FILE *fin, FILE *fou foreign_metadata_t *flac__foreign_metadata_new(foreign_block_type_t type) { /* calloc() to zero all the member variables */ - foreign_metadata_t *x = calloc(sizeof(foreign_metadata_t), 1); + foreign_metadata_t *x = calloc(1, sizeof(foreign_metadata_t)); if(x) { x->type = type; x->is_rf64 = false;