[FFmpeg-cvslog] fftools/ffprobe: Remove redundant check before avcodec_free_context()

Andreas Rheinhardt git at videolan.org
Tue Jun 8 16:05:00 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sat May 15 08:51:11 2021 +0200| [d29541c90aaa2e16d25411ba73f96576da99e0e1] | committer: Andreas Rheinhardt

fftools/ffprobe: Remove redundant check before avcodec_free_context()

Besides being unnecessary it is also safer: If the error for an
unrecognized option were triggered (which seems to be impossible right
now), it might be that the stream whose codecpar is accessed is NULL.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d29541c90aaa2e16d25411ba73f96576da99e0e1
---

 fftools/ffprobe.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 88e82a4195..2d452c212e 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3078,8 +3078,7 @@ static void close_input_file(InputFile *ifile)
 
     /* close decoder for each stream */
     for (i = 0; i < ifile->nb_streams; i++)
-        if (ifile->streams[i].st->codecpar->codec_id != AV_CODEC_ID_NONE)
-            avcodec_free_context(&ifile->streams[i].dec_ctx);
+        avcodec_free_context(&ifile->streams[i].dec_ctx);
 
     av_freep(&ifile->streams);
     ifile->nb_streams = 0;



More information about the ffmpeg-cvslog mailing list