mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: module-roc-{sink,source}: fix potential memory leaks
Two `pw_properties` objects are not freed in the error path. Resolves Coverity issues: 1468665, 1468666, 1468667, 1468668. Furthermore, the module argument string is also not freed.
This commit is contained in:
		
							parent
							
								
									6d64454300
								
							
						
					
					
						commit
						c04580a256
					
				
					 2 changed files with 10 additions and 0 deletions
				
			
		| 
						 | 
					@ -91,6 +91,9 @@ static int module_roc_sink_load(struct client *client, struct module *module)
 | 
				
			||||||
	data->mod = pw_context_load_module(module->impl->context,
 | 
						data->mod = pw_context_load_module(module->impl->context,
 | 
				
			||||||
			"libpipewire-module-roc-sink",
 | 
								"libpipewire-module-roc-sink",
 | 
				
			||||||
			args, NULL);
 | 
								args, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						free(args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (data->mod == NULL)
 | 
						if (data->mod == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -209,6 +212,8 @@ struct module *create_module_roc_sink(struct impl *impl, const char *argument)
 | 
				
			||||||
	return module;
 | 
						return module;
 | 
				
			||||||
out:
 | 
					out:
 | 
				
			||||||
	pw_properties_free(props);
 | 
						pw_properties_free(props);
 | 
				
			||||||
 | 
						pw_properties_free(sink_props);
 | 
				
			||||||
 | 
						pw_properties_free(roc_props);
 | 
				
			||||||
	errno = -res;
 | 
						errno = -res;
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,6 +93,9 @@ static int module_roc_source_load(struct client *client, struct module *module)
 | 
				
			||||||
	data->mod = pw_context_load_module(module->impl->context,
 | 
						data->mod = pw_context_load_module(module->impl->context,
 | 
				
			||||||
			"libpipewire-module-roc-source",
 | 
								"libpipewire-module-roc-source",
 | 
				
			||||||
			args, NULL);
 | 
								args, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						free(args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (data->mod == NULL)
 | 
						if (data->mod == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -218,6 +221,8 @@ struct module *create_module_roc_source(struct impl *impl, const char *argument)
 | 
				
			||||||
	return module;
 | 
						return module;
 | 
				
			||||||
out:
 | 
					out:
 | 
				
			||||||
	pw_properties_free(props);
 | 
						pw_properties_free(props);
 | 
				
			||||||
 | 
						pw_properties_free(source_props);
 | 
				
			||||||
 | 
						pw_properties_free(roc_props);
 | 
				
			||||||
	errno = -res;
 | 
						errno = -res;
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue