Commit a763d278 authored by Mark Thompson's avatar Mark Thompson

examples/vaapi_encode: Fix leak on hwframe init failure

Fixes CID #1424882.
parent 6939b3cb
...@@ -58,6 +58,7 @@ static int set_hwframe_ctx(AVCodecContext *ctx, AVBufferRef *hw_device_ctx) ...@@ -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) { if ((err = av_hwframe_ctx_init(hw_frames_ref)) < 0) {
fprintf(stderr, "Failed to initialize VAAPI frame context." fprintf(stderr, "Failed to initialize VAAPI frame context."
"Error code: %s\n",av_err2str(err)); "Error code: %s\n",av_err2str(err));
av_buffer_unref(&hw_frames_ref);
return err; return err;
} }
ctx->hw_frames_ctx = av_buffer_ref(hw_frames_ref); ctx->hw_frames_ctx = av_buffer_ref(hw_frames_ref);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment