diff mbox series

[FFmpeg-devel,38/39] fftools/ffprobe: Remove redundant check before avcodec_free_context()

Message ID HE1PR0301MB215441D1448B79A31111B55A8F299@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit d29541c90aaa2e16d25411ba73f96576da99e0e1
Headers show
Series [FFmpeg-devel,01/39] avcodec/audiotoolboxenc: Remove AV_CODEC_CAP_DR1 | expand


Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate warning Make fate failed

Commit Message

Andreas Rheinhardt May 21, 2021, 9:17 a.m. UTC
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@outlook.com>
 fftools/ffprobe.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series


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);
     ifile->nb_streams = 0;