diff --git a/sys/fs/cuse/cuse.c b/sys/fs/cuse/cuse.c index 2fc38dda3da6..765fe308af7b 100644 --- a/sys/fs/cuse/cuse.c +++ b/sys/fs/cuse/cuse.c @@ -671,8 +671,6 @@ cuse_server_unref(struct cuse_server *pcs) TAILQ_REMOVE(&cuse_server_head, pcs, entry); - cuse_free_unit_by_id_locked(pcs, -1); - while ((pcsd = TAILQ_FIRST(&pcs->hdev)) != NULL) { TAILQ_REMOVE(&pcs->hdev, pcsd, entry); cuse_unlock(); @@ -680,6 +678,8 @@ cuse_server_unref(struct cuse_server *pcs) cuse_lock(); } + cuse_free_unit_by_id_locked(pcs, -1); + while ((mem = TAILQ_FIRST(&pcs->hmem)) != NULL) { TAILQ_REMOVE(&pcs->hmem, mem, entry); cuse_unlock();