Commit 27c94c57 authored by James Almer's avatar James Almer

avformat/movenc: free eac3 private data only when closing the stream

This makes sure the data is available when writing the moov atom during the
second pass triggered by the faststart movflag.

Fixes ticket #7780
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 605e3303
......@@ -552,8 +552,7 @@ static int mov_write_eac3_tag(AVIOContext *pb, MOVTrack *track)
size = 2 + ((34 * (info->num_ind_sub + 1) + 7) >> 3);
buf = av_malloc(size);
if (!buf) {
size = AVERROR(ENOMEM);
goto end;
return AVERROR(ENOMEM);
}
init_put_bits(&pbc, buf, size);
......@@ -584,10 +583,6 @@ static int mov_write_eac3_tag(AVIOContext *pb, MOVTrack *track)
av_free(buf);
end:
av_packet_unref(&info->pkt);
av_freep(&track->eac3_priv);
return size;
}
......@@ -5973,6 +5968,11 @@ static void mov_free(AVFormatContext *s)
av_freep(&mov->tracks[i].frag_info);
av_packet_unref(&mov->tracks[i].cover_image);
if (mov->tracks[i].eac3_priv) {
struct eac3_info *info = mov->tracks[i].eac3_priv;
av_packet_unref(&info->pkt);
av_freep(&mov->tracks[i].eac3_priv);
}
if (mov->tracks[i].vos_len)
av_freep(&mov->tracks[i].vos_data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment