[FFmpeg-cvslog] avcodec/nvenc: also clear data pointer after unregistering a resource

Timo Rothenpieler git at videolan.org
Sun Jan 28 14:38:52 EET 2018


ffmpeg | branch: release/3.4 | Timo Rothenpieler <timo at rothenpieler.org> | Sun Jan 28 13:05:09 2018 +0100| [93c8720b914e7027d0e6401e6f64a9a4ce531d0c] | committer: Timo Rothenpieler

avcodec/nvenc: also clear data pointer after unregistering a resource

Signed-off-by: Timo Rothenpieler <timo at rothenpieler.org>

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

 libavcodec/nvenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 43d2549fb5..d36fa2951b 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1493,6 +1493,7 @@ static int nvenc_find_free_reg_resource(AVCodecContext *avctx)
                     nv_status = p_nvenc->nvEncUnregisterResource(ctx->nvencoder, ctx->registered_frames[i].regptr);
                     if (nv_status != NV_ENC_SUCCESS)
                         return nvenc_print_error(avctx, nv_status, "Failed unregistering unused input resource");
+                    ctx->registered_frames[i].ptr = 0;
                     ctx->registered_frames[i].regptr = NULL;
                 }
                 return i;
@@ -1751,6 +1752,7 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSur
                 res = nvenc_print_error(avctx, nv_status, "Failed unregistering input resource");
                 goto error;
             }
+            ctx->registered_frames[tmpoutsurf->reg_idx].ptr = 0;
             ctx->registered_frames[tmpoutsurf->reg_idx].regptr = NULL;
         } else if (ctx->registered_frames[tmpoutsurf->reg_idx].mapped < 0) {
             res = AVERROR_BUG;



More information about the ffmpeg-cvslog mailing list