[libcamera-devel] [PATCH] libcamera: stream: Initialise pixelFormat in StreamConfiguration()

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Jul 16 08:00:42 CEST 2019


To avoid depending on unitialised values, set the pixelFormat field of
the StreamConfiguration class to 0 in the constructor.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 src/libcamera/stream.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
index de505d12c07a..c28b4cd669b2 100644
--- a/src/libcamera/stream.cpp
+++ b/src/libcamera/stream.cpp
@@ -289,7 +289,7 @@ SizeRange StreamFormats::range(unsigned int pixelformat) const
  * handlers provied StreamFormats.
  */
 StreamConfiguration::StreamConfiguration()
-	: memoryType(InternalMemory), stream_(nullptr)
+	: pixelFormat(0), memoryType(InternalMemory), stream_(nullptr)
 {
 }
 
@@ -297,7 +297,8 @@ StreamConfiguration::StreamConfiguration()
  * \brief Construct a configuration with stream formats
  */
 StreamConfiguration::StreamConfiguration(const StreamFormats &formats)
-	: memoryType(InternalMemory), stream_(nullptr), formats_(formats)
+	: pixelFormat(0), memoryType(InternalMemory), stream_(nullptr),
+	  formats_(formats)
 {
 }
 
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list