[FFmpeg-cvslog] examples/vaapi_encode: Fix leak on hwframe init failure

Mark Thompson git at videolan.org
Fri Dec 1 23:12:49 EET 2017


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Fri Dec  1 21:06:42 2017 +0000| [a763d278274cfbda4e78e21b338b9b525fe22eab] | committer: Mark Thompson

examples/vaapi_encode: Fix leak on hwframe init failure

Fixes CID #1424882.

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

 doc/examples/vaapi_encode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/doc/examples/vaapi_encode.c b/doc/examples/vaapi_encode.c
index 866b03d58c..f66a4a7c48 100644
--- a/doc/examples/vaapi_encode.c
+++ b/doc/examples/vaapi_encode.c
@@ -58,6 +58,7 @@ static int set_hwframe_ctx(AVCodecContext *ctx, AVBufferRef *hw_device_ctx)
     if ((err = av_hwframe_ctx_init(hw_frames_ref)) < 0) {
         fprintf(stderr, "Failed to initialize VAAPI frame context."
                 "Error code: %s\n",av_err2str(err));
+        av_buffer_unref(&hw_frames_ref);
         return err;
     }
     ctx->hw_frames_ctx = av_buffer_ref(hw_frames_ref);



More information about the ffmpeg-cvslog mailing list