mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	spa: bluez: backend-native: fix a memory leak
In `_transport_create()`, if `spa_bt_transport_create()` failed then `pathfd` would be leaked.
This commit is contained in:
		
							parent
							
								
									2efccb3d01
								
							
						
					
					
						commit
						4a555ed6ff
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
					@ -216,8 +216,10 @@ static struct spa_bt_transport *_transport_create(struct rfcomm *rfcomm)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t = spa_bt_transport_create(backend->monitor, pathfd, sizeof(struct transport_data));
 | 
						t = spa_bt_transport_create(backend->monitor, pathfd, sizeof(struct transport_data));
 | 
				
			||||||
	if (t == NULL)
 | 
						if (t == NULL) {
 | 
				
			||||||
		goto finish;
 | 
							free(pathfd);
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	spa_bt_transport_set_implementation(t, &sco_transport_impl, t);
 | 
						spa_bt_transport_set_implementation(t, &sco_transport_impl, t);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t->device = rfcomm->device;
 | 
						t->device = rfcomm->device;
 | 
				
			||||||
| 
						 | 
					@ -248,7 +250,6 @@ static struct spa_bt_transport *_transport_create(struct rfcomm *rfcomm)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_bt_transport_add_listener(t, &rfcomm->transport_listener, &transport_events, rfcomm);
 | 
						spa_bt_transport_add_listener(t, &rfcomm->transport_listener, &transport_events, rfcomm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
finish:
 | 
					 | 
				
			||||||
	return t;
 | 
						return t;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue