Commit 7c05a7f7 authored by Raghavendra Rao's avatar Raghavendra Rao
Browse files

libcamera: fixed a small leak and double free

parent 5778de09
Pipeline #160695 passed with stages
in 1 minute and 35 seconds
......@@ -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();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment