Luca Dariz, le jeu. 28 déc. 2023 20:42:52 +0100, a ecrit: > + mach_port_t newname = 123;
Why initializing it? > + err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, > &newname); > + ASSERT_RET(err, "mach_port_allocate"); > + err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_PORT_SET, > &newname); > + ASSERT_RET(err, "mach_port_allocate"); > + err = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_DEAD_NAME, > &newname); > + ASSERT_RET(err, "mach_port_allocate"); You could check that you are getting different names. > + err = mach_port_destroy(mach_task_self(), newname); > + ASSERT_RET(err, "mach_port_destroy"); > + > + err = mach_port_deallocate(mach_task_self(), 1002); > + ASSERT_RET(err, "mach_port_deallocate"); > + > + mach_port_urefs_t urefs; > + err = mach_port_get_refs(mach_task_self(), 1002, > MACH_PORT_RIGHT_DEAD_NAME, &urefs); > + ASSERT_RET(err, "mach_port_get_refs"); You could also check the references of the ports created above. Samuel