mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	sink-input, source-output: Don't assume that proplist has been initialized in free()
It's bad form to assume in free() that any member of the struct has been initialized. I ran into problems with this when I reordered things in pa_sink_input_new() and pa_source_output_new().
This commit is contained in:
		
							parent
							
								
									d0fd59c34c
								
							
						
					
					
						commit
						49dd827373
					
				
					 2 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -745,7 +745,8 @@ static void sink_input_free(pa_object *o) {
 | 
				
			||||||
    if (PA_SINK_INPUT_IS_LINKED(i->state))
 | 
					    if (PA_SINK_INPUT_IS_LINKED(i->state))
 | 
				
			||||||
        pa_sink_input_unlink(i);
 | 
					        pa_sink_input_unlink(i);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_log_info("Freeing input %u \"%s\"", i->index, pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_MEDIA_NAME)));
 | 
					    pa_log_info("Freeing input %u \"%s\"", i->index,
 | 
				
			||||||
 | 
					                i->proplist ? pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_MEDIA_NAME)) : "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Side note: this function must be able to destruct properly any
 | 
					    /* Side note: this function must be able to destruct properly any
 | 
				
			||||||
     * kind of sink input in any state, even those which are
 | 
					     * kind of sink input in any state, even those which are
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -630,7 +630,8 @@ static void source_output_free(pa_object* mo) {
 | 
				
			||||||
    if (PA_SOURCE_OUTPUT_IS_LINKED(o->state))
 | 
					    if (PA_SOURCE_OUTPUT_IS_LINKED(o->state))
 | 
				
			||||||
        pa_source_output_unlink(o);
 | 
					        pa_source_output_unlink(o);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_log_info("Freeing output %u \"%s\"", o->index, pa_strnull(pa_proplist_gets(o->proplist, PA_PROP_MEDIA_NAME)));
 | 
					    pa_log_info("Freeing output %u \"%s\"", o->index,
 | 
				
			||||||
 | 
					                o->proplist ? pa_strnull(pa_proplist_gets(o->proplist, PA_PROP_MEDIA_NAME)) : "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (o->thread_info.delay_memblockq)
 | 
					    if (o->thread_info.delay_memblockq)
 | 
				
			||||||
        pa_memblockq_free(o->thread_info.delay_memblockq);
 | 
					        pa_memblockq_free(o->thread_info.delay_memblockq);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue