mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
libcamera: handle failure gracefully
Don't try to access NULL pointers
This commit is contained in:
parent
f8817b4394
commit
d71a10b7fa
3 changed files with 9 additions and 8 deletions
|
|
@ -540,7 +540,8 @@ extern "C" {
|
|||
}
|
||||
|
||||
void LibCamera::close() {
|
||||
this->cam_->release();
|
||||
if (this->cam_)
|
||||
this->cam_->release();
|
||||
}
|
||||
|
||||
void LibCamera::connect()
|
||||
|
|
@ -775,6 +776,9 @@ extern "C" {
|
|||
std::unique_ptr<CameraManager> cm = std::make_unique<CameraManager>();
|
||||
LibCamera* camera = new LibCamera();
|
||||
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutex_init(&camera->lock, &attr);
|
||||
|
||||
ret = cm->start();
|
||||
if (ret) {
|
||||
deleteLibCamera(camera);
|
||||
|
|
@ -794,9 +798,6 @@ extern "C" {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutex_init(&camera->lock, &attr);
|
||||
|
||||
camera->ring_buffer_init();
|
||||
|
||||
return camera;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue