aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2019-03-28 22:36:25 -0300
committerJames Almer <jamrial@gmail.com>2019-03-31 20:36:41 -0300
commit58cd70201edc57b46fb4ad8c0810725f0bf80c86 (patch)
treeef3a40a8313712f1c5f95919a18e7cd2ed8c4c43
parent1d720b37f0f3ae3d8e9fa2a991a8dca7deac7490 (diff)
downloadffmpeg-58cd70201edc57b46fb4ad8c0810725f0bf80c86.tar.gz
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: James Almer <jamrial@gmail.com> (cherry picked from commit 27c94c57dc84da8125225fda7d241be57d19b391)
-rw-r--r--libavformat/movenc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 6dab5193b0..2a45302ebb 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -544,8 +544,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);
@@ -576,10 +575,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;
}
@@ -5947,6 +5942,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);