Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
---
 libavcodec/nvdec.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index 15665b83bb..fbaedf0b6b 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -524,12 +524,9 @@ static int nvdec_retrieve_data(void *logctx, AVFrame 
*frame)
         goto copy_fail;
     }
 
-    av_buffer_unref(&frame->hw_frames_ctx);
-    frame->hw_frames_ctx = av_buffer_ref(decoder->real_hw_frames_ref);
-    if (!frame->hw_frames_ctx) {
-        ret = AVERROR(ENOMEM);
+    ret = av_buffer_replace(&frame->hw_frames_ctx, 
decoder->real_hw_frames_ref);
+    if (ret < 0)
         goto copy_fail;
-    }
 
     unmap_data->idx = cf->idx;
     if (!(unmap_data->idx_ref     = av_buffer_ref(cf->idx_ref)) ||
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to