summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-02-01 10:04:00 +0100
committerJacopo Mondi <jacopo@jmondi.org>2019-02-03 12:16:59 +0100
commitf8c0c5817ee43a8d0a30e13fcd1f2e20ec746f0d (patch)
tree88bac2ddacb094e0fad12ee80bf6946c6bfe73b8 /src
parenta9f302dc050347b69dfacfbca4bc212250f6a89c (diff)
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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/v4l2_device.cpp8
1 files changed, 4 insertions, 4 deletions
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;