Module: libav
Branch: master
Commit: 2eb396b175e55e515aa6a13c5b1789a2a18d3935

Author:    Mark Thompson <s...@jkqxz.net>
Committer: Mark Thompson <s...@jkqxz.net>
Date:      Fri Jan 26 23:12:18 2018 +0000

hwcontext: Fix memory leak on derived frame allocation failure

---

 libavutil/hwcontext.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index 6dc95bb..2630087 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);

_______________________________________________
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to