spa: audioconvert: fix allocation size calculation

Currently, the code allocates

  sizeof(header) * sizeof(item) * n_items

bytes instead of the more appropriate

  sizeof(header) + sizeof(item) * n_items

Fix that by simply changing the first multiplication to addition, and
furthermore, use a flexible array member instead of a zero-sized array.

Found by clang-tidy.
This commit is contained in:
Barnabás Pőcze 2022-01-18 21:10:31 +01:00
parent 6515553b7d
commit d2114c3f2e
2 changed files with 2 additions and 2 deletions

View file

@ -31,7 +31,7 @@
struct peaks_data {
uint32_t o_count;
uint32_t i_count;
float max_f[0];
float max_f[];
};
#if defined (HAVE_SSE)