avformat/hlsenc: Free context after hls_append_segment
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 16 Nov 2014 03:02:56 +0000 (04:02 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 16 Nov 2014 03:32:54 +0000 (04:32 +0100)
Fixes reading uninitialized memory

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/hlsenc.c

index 0525e70..e13f438 100644 (file)
@@ -389,9 +389,10 @@ static int hls_write_trailer(struct AVFormatContext *s)
     av_write_trailer(oc);
     hls->size = avio_tell(hls->avf->pb) - hls->start_pos;
     avio_closep(&oc->pb);
-    avformat_free_context(oc);
     av_free(hls->basename);
     hls_append_segment(hls, hls->duration, hls->start_pos, hls->size);
+    avformat_free_context(oc);
+    hls->avf = NULL;
     hls_window(s, 1);
 
     hls_free_segments(hls);