From f8c0c5817ee43a8d0a30e13fcd1f2e20ec746f0d Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Fri, 1 Feb 2019 10:04:00 +0100 Subject: libcamera: v4l2_device: Zero-initialize V4L2 format Zero initialize v4l2_format structures used to set and get format on the V4L2 device. Fixes: ba8da0f2fcd0 ("libcamera: v4l2_device: Add methods to get/set format") Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- src/libcamera/v4l2_device.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/libcamera') diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 0d4d60f5..b86a6295 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -299,7 +299,7 @@ int V4L2Device::setFormat(V4L2DeviceFormat *format) int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *format) { - struct v4l2_format v4l2Format; + struct v4l2_format v4l2Format = {}; struct v4l2_pix_format *pix = &v4l2Format.fmt.pix; int ret; @@ -323,7 +323,7 @@ int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *format) int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format) { - struct v4l2_format v4l2Format; + struct v4l2_format v4l2Format = {}; struct v4l2_pix_format *pix = &v4l2Format.fmt.pix; int ret; @@ -344,7 +344,7 @@ int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format) int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *format) { - struct v4l2_format v4l2Format; + struct v4l2_format v4l2Format = {}; struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp; int ret; @@ -371,7 +371,7 @@ int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *format) int V4L2Device::setFormatMultiplane(V4L2DeviceFormat *format) { - struct v4l2_format v4l2Format; + struct v4l2_format v4l2Format = {}; struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp; int ret; -- cgit v1.2.1