mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	raop: Fix memory leak
The return memory of the pa_strbuf_tostring_free() should be freed. pa_headerlist_puts() saves its own copy.
This commit is contained in:
		
							parent
							
								
									9011c4e4f7
								
							
						
					
					
						commit
						4e8562c1f1
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		| 
						 | 
					@ -214,11 +214,13 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
 | 
				
			||||||
        /* End of headers */
 | 
					        /* End of headers */
 | 
				
			||||||
        /* We will have a header left from our looping iteration, so add it in :) */
 | 
					        /* We will have a header left from our looping iteration, so add it in :) */
 | 
				
			||||||
        if (c->last_header) {
 | 
					        if (c->last_header) {
 | 
				
			||||||
 | 
					            char *tmp = pa_strbuf_tostring_free(c->header_buffer);
 | 
				
			||||||
            /* This is not a continuation header so let's dump it into our proplist */
 | 
					            /* This is not a continuation header so let's dump it into our proplist */
 | 
				
			||||||
            pa_headerlist_puts(c->response_headers, c->last_header, pa_strbuf_tostring_free(c->header_buffer));
 | 
					            pa_headerlist_puts(c->response_headers, c->last_header, tmp);
 | 
				
			||||||
 | 
					            pa_xfree(tmp);
 | 
				
			||||||
            pa_xfree(c->last_header);
 | 
					            pa_xfree(c->last_header);
 | 
				
			||||||
            c->last_header = NULL;
 | 
					            c->last_header = NULL;
 | 
				
			||||||
            c->header_buffer= NULL;
 | 
					            c->header_buffer = NULL;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pa_log_debug("Full response received. Dispatching");
 | 
					        pa_log_debug("Full response received. Dispatching");
 | 
				
			||||||
| 
						 | 
					@ -240,9 +242,11 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (c->last_header) {
 | 
					    if (c->last_header) {
 | 
				
			||||||
 | 
					        char *tmp = pa_strbuf_tostring_free(c->header_buffer);
 | 
				
			||||||
        /* This is not a continuation header so let's dump the full
 | 
					        /* This is not a continuation header so let's dump the full
 | 
				
			||||||
          header/value into our proplist */
 | 
					          header/value into our proplist */
 | 
				
			||||||
        pa_headerlist_puts(c->response_headers, c->last_header, pa_strbuf_tostring_free(c->header_buffer));
 | 
					        pa_headerlist_puts(c->response_headers, c->last_header, tmp);
 | 
				
			||||||
 | 
					        pa_xfree(tmp);
 | 
				
			||||||
        pa_xfree(c->last_header);
 | 
					        pa_xfree(c->last_header);
 | 
				
			||||||
        c->last_header = NULL;
 | 
					        c->last_header = NULL;
 | 
				
			||||||
        c->header_buffer = NULL;
 | 
					        c->header_buffer = NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue