[FFmpeg-devel] [PATCH] avutil/hwcontext_dxva2: return an error when buffer allocation fails

James Almer jamrial at gmail.com
Sun Sep 17 06:20:21 EEST 2017


This also prevents the use of an uninitialized variable.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavutil/hwcontext_dxva2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c
index 6c41788e2e..2ddd4be7b1 100644
--- a/libavutil/hwcontext_dxva2.c
+++ b/libavutil/hwcontext_dxva2.c
@@ -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);
-- 
2.14.1



More information about the ffmpeg-devel mailing list