aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/decoder_api.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c
index 0aca4da95..7df94e02f 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -232,13 +232,14 @@ decoder_data(struct decoder *decoder,
if (audio_format_equals(&dc.in_audio_format, &dc.out_audio_format)) {
data = _data;
} else {
- length = pcm_convert_size(&dc.in_audio_format, length,
- &dc.out_audio_format);
- if (length > conv_buffer_size) {
+ size_t out_length =
+ pcm_convert_size(&dc.in_audio_format, length,
+ &dc.out_audio_format);
+ if (out_length > conv_buffer_size) {
if (conv_buffer != NULL)
free(conv_buffer);
- conv_buffer = xmalloc(length);
- conv_buffer_size = length;
+ conv_buffer = xmalloc(out_length);
+ conv_buffer_size = out_length;
}
data = conv_buffer;