1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

Fix: Fixed deadlock on igloo_ro_get_instance()

This commit is contained in:
Philipp Schafft 2019-09-15 15:26:07 +00:00
parent b7aa541794
commit 3b68465b67

View File

@ -351,14 +351,17 @@ igloo_ro_t igloo_ro_get_instance(igloo_ro_t self)
} else {
ret = base->instance;
}
igloo_thread_mutex_unlock(&(base->lock));
/* We do this after unlock to avoid dead locks.
* This is valid as we have at least a weak ref to the target
*/
if (!igloo_RO_IS_NULL(ret)) {
if (igloo_ro_ref(ret) != igloo_ERROR_NONE) {
igloo_thread_mutex_unlock(&(base->lock));
return igloo_RO_NULL;
}
}
igloo_thread_mutex_unlock(&(base->lock));
return ret;
}