diff --git a/libfshelp/get-identity.c b/libfshelp/get-identity.c index f88e0f82..ac1b4f0b 100644 --- a/libfshelp/get-identity.c +++ b/libfshelp/get-identity.c @@ -70,10 +70,12 @@ id_clean (void *cookie) { struct idspec *i = cookie; pthread_mutex_lock (&idlock); - if (refcounts_hard_references(&i->pi.refcounts) == 0) + if (refcounts_hard_references(&i->pi.refcounts) == 0 + && i->id_hashloc != NULL) { - /* Nobody got a send right in between, we can remove from the hash. */ + /* Nobody got a send right in between, we can remove i from the hash. */ hurd_ihash_locp_remove (&idhash, i->id_hashloc); + i->id_hashloc = NULL; ports_port_deref_weak (&i->pi); } pthread_mutex_unlock (&idlock);