examples/vaapi_encode: Fix leak on hwframe init failure

Fixes CID #1424882.
This commit is contained in:
Mark Thompson 2017-12-01 21:06:42 +00:00
parent 6939b3cb9d
commit a763d27827
1 changed files with 1 additions and 0 deletions

View File

@ -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);