mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	filter-apply: Fix memory leak in process()
fltr->name should be freed before freeing fltr. Because filter_free() can never be called from other places without f set, the pa_assert() can be removed and filter_free() can be used in process() as well.
This commit is contained in:
		
							parent
							
								
									ab7d01a983
								
							
						
					
					
						commit
						1f0c4f7d6a
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		| 
						 | 
					@ -114,10 +114,10 @@ static struct filter *filter_new(const char *name, pa_sink *sink, pa_source *sou
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void filter_free(struct filter *f) {
 | 
					static void filter_free(struct filter *f) {
 | 
				
			||||||
    pa_assert(f);
 | 
					    if (f) {
 | 
				
			||||||
 | 
					        pa_xfree(f->name);
 | 
				
			||||||
    pa_xfree(f->name);
 | 
					        pa_xfree(f);
 | 
				
			||||||
    pa_xfree(f);
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const char* should_filter(pa_object *o, bool is_sink_input) {
 | 
					static const char* should_filter(pa_object *o, bool is_sink_input) {
 | 
				
			||||||
| 
						 | 
					@ -506,7 +506,7 @@ static pa_hook_result_t process(struct userdata *u, pa_object *o, bool is_sink_i
 | 
				
			||||||
 | 
					
 | 
				
			||||||
done:
 | 
					done:
 | 
				
			||||||
    pa_xfree(module_name);
 | 
					    pa_xfree(module_name);
 | 
				
			||||||
    pa_xfree(fltr);
 | 
					    filter_free(fltr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return PA_HOOK_OK;
 | 
					    return PA_HOOK_OK;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue