mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05: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
				
			
		| 
						 | 
				
			
			@ -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