[FFmpeg-devel] [PATCH] avcodec/codec_par: always free side data in the destination AVCodecContext

James Almer jamrial at gmail.com
Fri Jul 21 04:13:20 EEST 2023


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/codec_par.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c
index 775c187073..a38a475dc7 100644
--- a/libavcodec/codec_par.c
+++ b/libavcodec/codec_par.c
@@ -253,8 +253,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
         break;
     }
 
+    av_freep(&codec->extradata);
     if (par->extradata) {
-        av_freep(&codec->extradata);
         codec->extradata = av_mallocz(par->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
         if (!codec->extradata)
             return AVERROR(ENOMEM);
-- 
2.41.0



More information about the ffmpeg-devel mailing list