diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 3b50397010..a370b3d45c 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -308,9 +308,10 @@ static int hls_write_trailer(struct AVFormatContext *s) av_write_trailer(oc); avio_closep(&oc->pb); - avformat_free_context(oc); av_free(hls->basename); append_entry(hls, hls->duration); + avformat_free_context(oc); + hls->avf = NULL; hls_window(s, 1); free_entries(hls);