mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	tests: endpoint: fix valgrind uninit warning
Previously, valgrind was warning that Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s) this was caused by uninitialized values being serialized for IPC. Specifically, not all members of the `pw_endpoint_info` struct were initialized, which caused uninitialized bytes to end up in the IPC buffers due to the `pw_endpoint_emit_info()` in `endpoint_add_listener()`. Fix that by initializing the missed `id` and `flags` members.
This commit is contained in:
		
							parent
							
								
									f2fb0b0aa5
								
							
						
					
					
						commit
						e6e36c4d34
					
				
					 1 changed files with 2 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -199,10 +199,12 @@ endpoint_init(struct endpoint * self)
 | 
			
		|||
	spa_hook_list_init (&self->hooks);
 | 
			
		||||
 | 
			
		||||
	self->info.version = PW_VERSION_ENDPOINT_INFO;
 | 
			
		||||
	self->info.id = SPA_ID_INVALID;
 | 
			
		||||
	self->info.change_mask = PW_ENDPOINT_CHANGE_MASK_ALL;
 | 
			
		||||
	self->info.name = "test-endpoint";
 | 
			
		||||
	self->info.media_class = "Audio/Sink";
 | 
			
		||||
	self->info.direction = PW_DIRECTION_OUTPUT;
 | 
			
		||||
	self->info.flags = 0;
 | 
			
		||||
	self->info.n_streams = 0;
 | 
			
		||||
	self->info.session_id = SPA_ID_INVALID;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -434,12 +436,6 @@ static void test_endpoint(void)
 | 
			
		|||
 | 
			
		||||
int main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
	/* FIXME: This test has a leak and a use of uninitialized buffer
 | 
			
		||||
	 * that needs to be debugged and fixed (or excluded). Meanwhile -
 | 
			
		||||
	 * skip it from valgrind so we can at least use the others. */
 | 
			
		||||
	if (RUNNING_ON_VALGRIND)
 | 
			
		||||
		return 77;
 | 
			
		||||
 | 
			
		||||
	pw_init(&argc, &argv);
 | 
			
		||||
 | 
			
		||||
	alarm(5); /* watchdog; terminate after 5 seconds */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue