From e6e36c4d348745629b431f287583cc62a1ce2bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sun, 20 Jul 2025 18:29:16 +0200 Subject: [PATCH] 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. --- src/tests/test-endpoint.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/tests/test-endpoint.c b/src/tests/test-endpoint.c index c6956c2e2..412fa6703 100644 --- a/src/tests/test-endpoint.c +++ b/src/tests/test-endpoint.c @@ -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 */