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 <tomi.valkeinen@iki.fi>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Kieran Bingham 2020-10-23 10:59:12 +01:00
parent 7973efcbc0
commit 7adf3a0698

View file

@ -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);
}
/*