diff mbox series

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

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


Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili Nov. 20, 2022, 6:49 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 4c48b9142e..69a462ec48 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");