]> git.sesse.net Git - ffmpeg/blobdiff - ffmpeg.c
ffmpeg: remove unneeded NULL pointer check
[ffmpeg] / ffmpeg.c
index ddf42726d9df2aa36d3214a2d24584ae52218885..f9aa65f765c583f50d8df27d5a2d5c0da5c432b0 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -458,8 +458,8 @@ static void ffmpeg_cleanup(int ret)
     for (i = 0; i < nb_output_files; i++) {
         OutputFile *of = output_files[i];
         AVFormatContext *s = of->ctx;
-        if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE) && s->pb)
-            avio_close(s->pb);
+        if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE))
+            avio_closep(&s->pb);
         avformat_free_context(s);
         av_dict_free(&of->opts);
 
@@ -1560,8 +1560,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
         avio_flush(progress_avio);
         av_bprint_finalize(&buf_script, NULL);
         if (is_last_report) {
-            avio_close(progress_avio);
-            progress_avio = NULL;
+            avio_closep(&progress_avio);
         }
     }
 
@@ -2293,7 +2292,7 @@ static void print_sdp(void)
             av_log(NULL, AV_LOG_ERROR, "Failed to open sdp file '%s'\n", sdp_filename);
         } else {
             avio_printf(sdp_pb, "SDP:\n%s", sdp);
-            avio_close(sdp_pb);
+            avio_closep(&sdp_pb);
             av_freep(&sdp_filename);
         }
     }
@@ -2543,7 +2542,7 @@ static int transcode_init(void)
     AVFormatContext *oc;
     OutputStream *ost;
     InputStream *ist;
-    char error[1024];
+    char error[1024] = {0};
     int want_sdp = 1;
 
     for (i = 0; i < nb_filtergraphs; i++) {