summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-05-20 17:04:59 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-05-21 13:35:29 +0200
commite8cc0a26583ce6fa3d25fd10173a037f2c5e57c8 (patch)
tree320b3dbe70a6e79b4c630cdad3b0ab9036e4754d
parentc31785156bf9d6cbb5e4c41bf3f7344914bbb411 (diff)
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>
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 07ca9f5d..e16a9c7f 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -304,7 +304,8 @@ public:
}
/* Stop the IPA proxy thread. */
- ipa_->stop();
+ if (ipa_)
+ ipa_->stop();
}
void frameStarted(uint32_t sequence);