Index: uspace/lib/ddev/test/ddev.c
===================================================================
--- uspace/lib/ddev/test/ddev.c	(revision f05f413833a5111b7083577d666c37f4be97cdcc)
+++ uspace/lib/ddev/test/ddev.c	(revision 350ec74aaf36e89812dd2e151117f72652dcca45)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2019 Jiri Svoboda
+ * Copyright (c) 2023 Jiri Svoboda
  * All rights reserved.
  *
@@ -78,21 +78,23 @@
 	ddev_t *ddev = NULL;
 	test_response_t resp;
-
-	async_set_fallback_port_handler(test_ddev_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ddev_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_ddev_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ddev_open(test_ddev_svc, &ddev);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ddev);
-
-	ddev_close(ddev);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_ddev_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_ddev_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_ddev_svc, &sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ddev_open(test_ddev_svc, &ddev);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(ddev);
+
+	ddev_close(ddev);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -105,12 +107,13 @@
 	test_response_t resp;
 	gfx_context_t *gc;
-
-	async_set_fallback_port_handler(test_ddev_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ddev_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_ddev_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_ddev_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_ddev_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_ddev_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -126,6 +129,7 @@
 
 	ddev_close(ddev);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -139,12 +143,13 @@
 	gfx_context_t *gc;
 	gfx_color_t *color;
-
-	async_set_fallback_port_handler(test_ddev_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ddev_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_ddev_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_ddev_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_ddev_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_ddev_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -170,6 +175,7 @@
 
 	ddev_close(ddev);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -182,12 +188,13 @@
 	test_response_t resp;
 	ddev_info_t info;
-
-	async_set_fallback_port_handler(test_ddev_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ddev_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_ddev_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_ddev_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_ddev_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_ddev_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -201,6 +208,7 @@
 
 	ddev_close(ddev);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
@@ -213,12 +221,13 @@
 	test_response_t resp;
 	ddev_info_t info;
-
-	async_set_fallback_port_handler(test_ddev_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ddev_server);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(test_ddev_svc, &sid);
+	loc_srv_t *srv;
+
+	async_set_fallback_port_handler(test_ddev_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_ddev_server, &srv);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(srv, test_ddev_svc, &sid);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -244,6 +253,7 @@
 
 	ddev_close(ddev);
-	rc = loc_service_unregister(sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	rc = loc_service_unregister(srv, sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	loc_server_unregister(srv);
 }
 
