diff mbox series

[FFmpeg-devel,04/12] avcodec/mediacodecdec_common: fix useless av_buffer_unref

Message ID tencent_DB6635E5807A35953EE556D19C76E05E5B09@qq.com
State New
Headers show
Series Add MediaCodec encoder and NDK MediaCodec support | expand


Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili Oct. 24, 2022, 3:16 a.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

Since frame->buf[0] is always NULL in this case, av_buffer_unref
has no effect. If it's not NULL, double-free will happen.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
 libavcodec/mediacodecdec_common.c | 1 -
 1 file changed, 1 deletion(-)
diff mbox series


diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c
index 940b4e02d5..d6ce709dd8 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -335,7 +335,6 @@  static int mediacodec_wrap_hw_buffer(AVCodecContext *avctx,
     return 0;
-    av_buffer_unref(&frame->buf[0]);
     status = ff_AMediaCodec_releaseOutputBuffer(s->codec, index, 0);
     if (status < 0) {
         av_log(avctx, AV_LOG_ERROR, "Failed to release output buffer\n");