From 7adf3a069839c1b2c440b07ca2911ffc2d39e816 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Fri, 23 Oct 2020 10:59:12 +0100 Subject: libcamera: pipeline: simple: Only connect created converters If converter_->open() fails, the code deletes the converter_ but then happily goes on, and at the very next lines will use converter_ to connect the bufferReady signal. Ensure the converter is only connected when successfully opened by extending the conditional and connecting in an else scope instead. Reported-by: Tomi Valkeinen Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/simple/simple.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libcamera/pipeline/simple') diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 0d48e1b6..3d2039f3 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -774,9 +774,9 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator) << "Failed to open converter, disabling format conversion"; delete converter_; converter_ = nullptr; + } else { + converter_->bufferReady.connect(this, &SimplePipelineHandler::converterDone); } - - converter_->bufferReady.connect(this, &SimplePipelineHandler::converterDone); } /* -- cgit v1.2.1