diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index e46ca39a57..5fb68cdc54 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -738,7 +738,8 @@ static void profile_rwunlock(vm_profile_t *profile) { switch_thread_rwlock_unlock(profile->rwlock); if (switch_test_flag(profile, PFLAG_DESTROY)) { - if (switch_thread_rwlock_tryrdlock(profile->rwlock) == SWITCH_STATUS_SUCCESS) { + if (switch_thread_rwlock_trywrlock(profile->rwlock) == SWITCH_STATUS_SUCCESS) { + switch_thread_rwlock_unlock(profile->rwlock); free_profile(profile); } }