aboutsummaryrefslogtreecommitdiffstats
path: root/output_example.c
diff options
context:
space:
mode:
authorArt Clarke <aclarke@vlideshow.com>2009-02-18 06:49:32 +0000
committerAndreas Ă–man <andreas@lonelycoder.com>2009-02-18 06:49:32 +0000
commitde43a23977ceff42d9e2bdec23732d12ebf7508f (patch)
tree85a1f6c7b9599b547e693fa34931f71762c456c9 /output_example.c
parent6739fa54b8947fa8dd8250ae0eab8e765cc225e8 (diff)
downloadffmpeg-de43a23977ceff42d9e2bdec23732d12ebf7508f.tar.gz
av_write_trailer() must be done before closing codecs.
Patch by aclarke a xuggle d com Originally committed as revision 17422 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'output_example.c')
-rw-r--r--output_example.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/output_example.c b/output_example.c
index 612146dad0..6cd1b34080 100644
--- a/output_example.c
+++ b/output_example.c
@@ -523,15 +523,18 @@ int main(int argc, char **argv)
}
}
+ /* write the trailer, if any. the trailer must be written
+ * before you close the CodecContexts open when you wrote the
+ * header; otherwise write_trailer may try to use memory that
+ * was freed on av_codec_close() */
+ av_write_trailer(oc);
+
/* close each codec */
if (video_st)
close_video(oc, video_st);
if (audio_st)
close_audio(oc, audio_st);
- /* write the trailer, if any */
- av_write_trailer(oc);
-
/* free the streams */
for(i = 0; i < oc->nb_streams; i++) {
av_freep(&oc->streams[i]->codec);