[FFmpeg-cvslog] avcodec/avcodec: free decoded_side_data in ff_codec_close()

James Almer git at videolan.org
Thu May 2 16:40:46 EEST 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed May  1 12:01:48 2024 -0300| [86e418ffd7bbdc0530e1e4d5bd7534b6e03b5b05] | committer: James Almer

avcodec/avcodec: free decoded_side_data in ff_codec_close()

It's set by the library when decoding, so it should be freed when closing the
context.

Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavcodec/avcodec.c | 2 ++
 libavcodec/options.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 888dd76228..214dca4566 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -462,6 +462,8 @@ av_cold void ff_codec_close(AVCodecContext *avctx)
         av_freep(&avctx->coded_side_data[i].data);
     av_freep(&avctx->coded_side_data);
     avctx->nb_coded_side_data = 0;
+    av_frame_side_data_free(&avctx->decoded_side_data,
+                            &avctx->nb_decoded_side_data);
 
     av_buffer_unref(&avctx->hw_frames_ctx);
     av_buffer_unref(&avctx->hw_device_ctx);
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 0c3b40a186..f60c41bdc3 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -177,8 +177,6 @@ void avcodec_free_context(AVCodecContext **pavctx)
     av_freep(&avctx->inter_matrix);
     av_freep(&avctx->rc_override);
     av_channel_layout_uninit(&avctx->ch_layout);
-    av_frame_side_data_free(
-        &avctx->decoded_side_data, &avctx->nb_decoded_side_data);
 
     av_freep(pavctx);
 }



More information about the ffmpeg-cvslog mailing list