diff mbox

[FFmpeg-devel,02/24] vaapi_encode: Discard output buffer if picture submission fails

Message ID 20170612224041.6750-3-sw@jkqxz.net
State Accepted
Commit 17aeee5832b9188b570c3d3de4197e4cdc54c634
Headers show

Commit Message

Mark Thompson June 12, 2017, 10:40 p.m. UTC
Previously this was leaking, though it actually hit an assert making
sure that the buffer had already been cleared when freeing the picture.

(cherry picked from commit 17aeee5832b9188b570c3d3de4197e4cdc54c634)
---
 libavcodec/vaapi_encode.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 7e9c00f51d..7aaf263d25 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -428,6 +428,8 @@  fail:
 fail_at_end:
     av_freep(&pic->codec_picture_params);
     av_frame_free(&pic->recon_image);
+    av_buffer_unref(&pic->output_buffer_ref);
+    pic->output_buffer = VA_INVALID_ID;
     return err;
 }