hwcontext: Fix memory leak on derived frame allocation failure
authorMark Thompson <sw@jkqxz.net>
Fri, 26 Jan 2018 23:12:18 +0000 (23:12 +0000)
committerMark Thompson <sw@jkqxz.net>
Sun, 4 Feb 2018 13:47:25 +0000 (13:47 +0000)
libavutil/hwcontext.c

index 6dc95bb..2630087 100644 (file)
@@ -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);