[FFmpeg-devel,2/2] hwcontext_vaapi: Zero unused fields of external buffer descriptor

Submitted by Mark Thompson on Sept. 3, 2018, 12:01 a.m.

Details

Message ID 0e2286cb-cb0b-f8a9-fca0-c7d6f9fd4167@jkqxz.net
State New
Headers show

Commit Message

Mark Thompson Sept. 3, 2018, 12:01 a.m.
---
Though nothing should look directly as these fields having random stack data in them is confusing for debugging.


 libavutil/hwcontext_vaapi.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index cc3739f6ec..9dc1d30d37 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -1039,13 +1039,15 @@  static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst,
     av_assert0(i < FF_ARRAY_ELEMS(vaapi_format_map));
 
     buffer_handle = desc->objects[0].fd;
-    buffer_desc.pixel_format = va_fourcc;
-    buffer_desc.width        = src_fc->width;
-    buffer_desc.height       = src_fc->height;
-    buffer_desc.data_size    = desc->objects[0].size;
-    buffer_desc.buffers      = &buffer_handle;
-    buffer_desc.num_buffers  = 1;
-    buffer_desc.flags        = 0;
+    buffer_desc = (VASurfaceAttribExternalBuffers) {
+        .pixel_format = va_fourcc,
+        .width        = src_fc->width,
+        .height       = src_fc->height,
+        .data_size    = desc->objects[0].size,
+        .buffers      = &buffer_handle,
+        .num_buffers  = 1,
+        .flags        = 0,
+    };
 
     k = 0;
     for (i = 0; i < desc->nb_layers; i++) {