]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/hdsenc.c
Merge commit '7915e6741dbe1cf3a8781cead3e68a7666de14f4'
[ffmpeg] / libavformat / hdsenc.c
index a161b642c97d48156f13a7582716bb35094f59e4..48810a9a34e9cd3a596ba11c48a9d5ad559a4ede 100644 (file)
@@ -139,12 +139,10 @@ static void hds_free(AVFormatContext *s)
         return;
     for (i = 0; i < s->nb_streams; i++) {
         OutputStream *os = &c->streams[i];
-        if (os->out)
-            avio_close(os->out);
-        os->out = NULL;
+        avio_closep(&os->out);
         if (os->ctx && os->ctx_inited)
             av_write_trailer(os->ctx);
-        if (os->ctx && os->ctx->pb)
+        if (os->ctx)
             av_freep(&os->ctx->pb);
         if (os->ctx)
             avformat_free_context(os->ctx);
@@ -311,8 +309,7 @@ static void close_file(OutputStream *os)
     avio_seek(os->out, 0, SEEK_SET);
     avio_wb32(os->out, pos);
     avio_flush(os->out);
-    avio_close(os->out);
-    os->out = NULL;
+    avio_closep(&os->out);
 }
 
 static int hds_write_header(AVFormatContext *s)