[FFmpeg-cvslog] avcodec/mediacodecdec_common: fix useless av_buffer_unref

Zhao Zhili git at videolan.org
Mon Nov 21 18:05:20 EET 2022


ffmpeg | branch: master | Zhao Zhili <zhilizhao at tencent.com> | Fri Oct 21 18:25:08 2022 +0800| [d4b06c99abf3e147f7b1ce7160d31d2dcc525eda] | committer: Zhao Zhili

avcodec/mediacodecdec_common: fix useless av_buffer_unref

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 at tencent.com>

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

 libavcodec/mediacodecdec_common.c | 1 -
 1 file changed, 1 deletion(-)

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;
 fail:
     av_freep(&buffer);
-    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");



More information about the ffmpeg-cvslog mailing list