mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	fix some small memory leaks
This commit is contained in:
		
							parent
							
								
									4faa28fd96
								
							
						
					
					
						commit
						61ad5ee518
					
				
					 4 changed files with 21 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -249,9 +249,18 @@ static void clear_mem(struct node_data *data, struct mem *m)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void clear_link(struct node_data *data, struct link *link)
 | 
			
		||||
{
 | 
			
		||||
	link->node_id = SPA_ID_INVALID;
 | 
			
		||||
	link->target.activation = NULL;
 | 
			
		||||
	close(link->signalfd);
 | 
			
		||||
	spa_list_remove(&link->target.link);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void clean_transport(struct node_data *data)
 | 
			
		||||
{
 | 
			
		||||
	struct mem *m;
 | 
			
		||||
	struct link *l;
 | 
			
		||||
 | 
			
		||||
	if (data->rtsocket_source == NULL)
 | 
			
		||||
		return;
 | 
			
		||||
| 
						 | 
				
			
			@ -262,6 +271,10 @@ static void clean_transport(struct node_data *data)
 | 
			
		|||
		clear_mem(data, m);
 | 
			
		||||
	pw_array_clear(&data->mems);
 | 
			
		||||
 | 
			
		||||
	pw_array_for_each(l, &data->links)
 | 
			
		||||
		clear_link(data, l);
 | 
			
		||||
	pw_array_clear(&data->links);
 | 
			
		||||
 | 
			
		||||
	close(data->rtwritefd);
 | 
			
		||||
	data->remote_id = SPA_ID_INVALID;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1030,10 +1043,7 @@ client_node_set_activation(void *object,
 | 
			
		|||
			res = -EINVAL;
 | 
			
		||||
			goto exit;
 | 
			
		||||
		}
 | 
			
		||||
		link->node_id = SPA_ID_INVALID;
 | 
			
		||||
		link->target.activation = NULL;
 | 
			
		||||
		close(link->signalfd);
 | 
			
		||||
		spa_list_remove(&link->target.link);
 | 
			
		||||
		clear_link(data, link);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
      exit:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -310,7 +310,8 @@ void pw_module_destroy(struct pw_module *module)
 | 
			
		|||
 | 
			
		||||
	pw_properties_free(module->properties);
 | 
			
		||||
 | 
			
		||||
	dlclose(impl->hnd);
 | 
			
		||||
	if (dlclose(impl->hnd) != 0)
 | 
			
		||||
		pw_log_warn("dlclose failed: %s", dlerror());
 | 
			
		||||
	free(impl);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1108,6 +1108,8 @@ void pw_node_destroy(struct pw_node *node)
 | 
			
		|||
	pw_log_debug("node %p: free", node);
 | 
			
		||||
	pw_node_emit_free(node);
 | 
			
		||||
 | 
			
		||||
	pw_memblock_free(node->activation);
 | 
			
		||||
 | 
			
		||||
	pw_work_queue_destroy(impl->work);
 | 
			
		||||
 | 
			
		||||
	pw_map_clear(&node->input_port_map);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -296,6 +296,9 @@ static void configure_debug(struct support *support, const char *str)
 | 
			
		|||
 | 
			
		||||
	if (n_tokens > 1)
 | 
			
		||||
		support->categories = pw_split_strv(level[1], ",", INT_MAX, &n_tokens);
 | 
			
		||||
 | 
			
		||||
	if (level)
 | 
			
		||||
		pw_free_strv(level);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Get a support interface
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue