avutil/hwcontext_dxva2: return an error when buffer allocation fails
authorJames Almer <jamrial@gmail.com>
Sun, 17 Sep 2017 03:17:42 +0000 (00:17 -0300)
committerJames Almer <jamrial@gmail.com>
Tue, 19 Sep 2017 22:30:08 +0000 (19:30 -0300)
This also prevents the use of an uninitialized variable.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
libavutil/hwcontext_dxva2.c

index 6c41788..2ddd4be 100644 (file)
@@ -307,8 +307,10 @@ static int dxva2_map_frame(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *
     }
 
     map = av_mallocz(sizeof(*map));
-    if (!map)
+    if (!map) {
+        err = AVERROR(ENOMEM);
         goto fail;
+    }
 
     err = ff_hwframe_map_create(src->hw_frames_ctx, dst, src,
                                 dxva2_unmap_frame, map);