mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	fix modargs memory leak
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@68 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									1416fef197
								
							
						
					
					
						commit
						ed9bd5f01f
					
				
					 4 changed files with 19 additions and 7 deletions
				
			
		| 
						 | 
					@ -306,11 +306,16 @@ int pa_module_init(struct pa_core *c, struct pa_module*m) {
 | 
				
			||||||
    u->mainloop_source = c->mainloop->source_io(c->mainloop, u->fd, (u->source ? PA_MAINLOOP_API_IO_EVENT_INPUT : 0) | (u->sink ? PA_MAINLOOP_API_IO_EVENT_OUTPUT : 0), io_callback, u);
 | 
					    u->mainloop_source = c->mainloop->source_io(c->mainloop, u->fd, (u->source ? PA_MAINLOOP_API_IO_EVENT_INPUT : 0) | (u->sink ? PA_MAINLOOP_API_IO_EVENT_OUTPUT : 0), io_callback, u);
 | 
				
			||||||
    assert(u->mainloop_source);
 | 
					    assert(u->mainloop_source);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_modargs_free(ma);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fail:
 | 
					fail:
 | 
				
			||||||
    pa_module_done(c, m);
 | 
					    pa_module_done(c, m);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (ma)
 | 
				
			||||||
 | 
					        pa_modargs_free(ma);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    return -1;
 | 
					    return -1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -229,6 +229,8 @@ int pa_module_init(struct pa_core *c, struct pa_module*m) {
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    m->userdata = u;
 | 
					    m->userdata = u;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_modargs_free(ma);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fail:
 | 
					fail:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,23 +107,30 @@ struct pa_socket_server *create_socket_server(struct pa_core *c, struct pa_modar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int pa_module_init(struct pa_core *c, struct pa_module*m) {
 | 
					int pa_module_init(struct pa_core *c, struct pa_module*m) {
 | 
				
			||||||
    struct pa_socket_server *s;
 | 
					    struct pa_socket_server *s;
 | 
				
			||||||
    struct pa_modargs *ma;
 | 
					    struct pa_modargs *ma = NULL;
 | 
				
			||||||
 | 
					    int ret = -1;
 | 
				
			||||||
    assert(c && m);
 | 
					    assert(c && m);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
 | 
					    if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
 | 
				
			||||||
        fprintf(stderr, "Failed to parse module arguments\n");
 | 
					        fprintf(stderr, "Failed to parse module arguments\n");
 | 
				
			||||||
        return -1;
 | 
					        goto finish;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!(s = create_socket_server(c, ma)))
 | 
					    if (!(s = create_socket_server(c, ma)))
 | 
				
			||||||
        return -1;
 | 
					        goto finish;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!(m->userdata = protocol_new(c, s, m, ma))) {
 | 
					    if (!(m->userdata = protocol_new(c, s, m, ma))) {
 | 
				
			||||||
        pa_socket_server_free(s);
 | 
					        pa_socket_server_free(s);
 | 
				
			||||||
        return -1;
 | 
					        goto finish;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return 0;
 | 
					    ret = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					finish:
 | 
				
			||||||
 | 
					    if (ma)
 | 
				
			||||||
 | 
					        pa_modargs_free(ma);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void pa_module_done(struct pa_core *c, struct pa_module*m) {
 | 
					void pa_module_done(struct pa_core *c, struct pa_module*m) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								src/todo
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								src/todo
									
										
									
									
									
								
							| 
						 | 
					@ -1,5 +1,3 @@
 | 
				
			||||||
- modargs memory leak
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- clean secure directory handling (with username)
 | 
					- clean secure directory handling (with username)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- native library/protocol:
 | 
					- native library/protocol:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue