mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
libcamera: fixed a small leak and double free
This commit is contained in:
parent
5778de090f
commit
7c05a7f7b4
3 changed files with 10 additions and 11 deletions
|
|
@ -162,7 +162,6 @@ static int impl_clear(struct spa_handle *handle)
|
|||
|
||||
if(this->dev.camera) {
|
||||
deleteLibCamera(this->dev.camera);
|
||||
free(this->dev.camera);
|
||||
this->dev.camera = NULL;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -900,7 +900,6 @@ static int impl_clear(struct spa_handle *handle)
|
|||
|
||||
if(port->dev.camera) {
|
||||
deleteLibCamera(port->dev.camera);
|
||||
free(port->dev.camera);
|
||||
port->dev.camera = NULL;
|
||||
}
|
||||
if(this->have_source) {
|
||||
|
|
|
|||
|
|
@ -529,6 +529,16 @@ extern "C" {
|
|||
void LibCamera::stop() {
|
||||
this->disconnect();
|
||||
|
||||
uint32_t bufIdx = 0;
|
||||
StreamConfiguration &cfg = this->config_->at(0);
|
||||
Stream *stream = cfg.stream();
|
||||
|
||||
for (const std::unique_ptr<FrameBuffer> &buffer : this->allocator_->buffers(stream)) {
|
||||
delete [] this->fd_[bufIdx];
|
||||
bufIdx++;
|
||||
}
|
||||
delete [] this->fd_;
|
||||
|
||||
spa_log_info(this->log_, "Stopping camera ...");
|
||||
this->cam_->stop();
|
||||
if(this->allocator_) {
|
||||
|
|
@ -536,15 +546,6 @@ extern "C" {
|
|||
this->allocator_ = nullptr;
|
||||
}
|
||||
|
||||
if(this->fd_) {
|
||||
for(uint32_t i = 0; i < this->nplanes_; i++) {
|
||||
delete this->fd_[i];
|
||||
this->fd_[i] = nullptr;
|
||||
}
|
||||
delete this->fd_;
|
||||
this->fd_ = nullptr;
|
||||
}
|
||||
|
||||
this->item_free_fn();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue