diff --git a/libavformat/iamfdec.c b/libavformat/iamfdec.c index 28d69b8b3f..3b8d2ff358 100644 --- a/libavformat/iamfdec.c +++ b/libavformat/iamfdec.c @@ -404,6 +404,7 @@ static int iamf_read_header(AVFormatContext *s) if (!stg) return AVERROR(ENOMEM); + av_iamf_audio_element_free(&stg->params.iamf_audio_element); stg->id = audio_element->audio_element_id; stg->params.iamf_audio_element = audio_element->element; @@ -435,6 +436,7 @@ static int iamf_read_header(AVFormatContext *s) if (!stg) return AVERROR(ENOMEM); + av_iamf_mix_presentation_free(&stg->params.iamf_mix_presentation); stg->id = mix_presentation->mix_presentation_id; stg->params.iamf_mix_presentation = mix_presentation->mix;