summaryrefslogtreecommitdiff
path: root/libavutil/hwcontext.c
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-01-26 23:12:18 +0000
committerMark Thompson <sw@jkqxz.net>2018-02-04 13:47:25 +0000
commit2eb396b175e55e515aa6a13c5b1789a2a18d3935 (patch)
treef20e8d326b0a237cb7053d3b289fe1f09ce43811 /libavutil/hwcontext.c
parent96e476cc9d414e248692c773d9dce736662572b8 (diff)
downloadffmpeg-2eb396b175e55e515aa6a13c5b1789a2a18d3935.tar.gz
hwcontext: Fix memory leak on derived frame allocation failure
Diffstat (limited to 'libavutil/hwcontext.c')
-rw-r--r--libavutil/hwcontext.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index 6dc95bba15..2630087b5d 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -470,8 +470,10 @@ int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
ret = av_hwframe_get_buffer(ctx->internal->source_frames,
src_frame, 0);
- if (ret < 0)
+ if (ret < 0) {
+ av_frame_free(&src_frame);
return ret;
+ }
ret = av_hwframe_map(frame, src_frame,
ctx->internal->source_allocation_map_flags);