libcamera: raspberry: Fix segfault in ~RPiCameraData()

The RPiCameraData class destructor tries to stop its ipa_ instance
without making sure it has been initialized.

If the RPiCameraData gets destroyed before its ipa_ member is
initialized, for example if the sensor initialization fails during the
match() function, a nullptr dereference segfault is triggered preventing
a graceful library teardown.

Fix this by checking for ipa_ to be initialized before stopping it.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi 2020-05-20 17:04:59 +02:00
parent c31785156b
commit e8cc0a2658

View file

@ -304,7 +304,8 @@ public:
}
/* Stop the IPA proxy thread. */
ipa_->stop();
if (ipa_)
ipa_->stop();
}
void frameStarted(uint32_t sequence);