[FFmpeg-devel] [PATCH] avformat/mov: move av_freep to if block to reduce no-ops

Zhao Zhili quinkblack at foxmail.com
Wed Sep 23 19:47:46 EEST 2020


Use the check since it's there already.
---
 libavformat/mov.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4f64e96bc0..dcd263b02a 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2909,9 +2909,10 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     av_log(c->fc, AV_LOG_TRACE, "track[%u].stts.entries = %u\n",
             c->fc->nb_streams-1, entries);
 
-    if (sc->stts_data)
+    if (sc->stts_data) {
         av_log(c->fc, AV_LOG_WARNING, "Duplicated STTS atom\n");
-    av_freep(&sc->stts_data);
+        av_freep(&sc->stts_data);
+    }
     sc->stts_count = 0;
     if (entries >= INT_MAX / sizeof(*sc->stts_data))
         return AVERROR(ENOMEM);
-- 
2.25.1



More information about the ffmpeg-devel mailing list