2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2025-01-27 05:58:20 +03:00

Fixed crash in some cases when a plugin is unloaded

This commit is contained in:
s1lent 2017-11-19 04:07:03 +07:00
parent 98fd23afed
commit c8e836d28f
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C

View File

@ -659,9 +659,10 @@ bool MPlugin::clear()
META_ERROR("Cannot clear plugin '%s'; not marked as failed, empty, or open (status=%s)", m_desc, str_status());
return false;
}
// If file is open, close the file. Note: after this, attempts to
// reference any memory locations in the file will produce a segfault.
if (!m_sys_module.unload()) {
if (m_sys_module.is_opened() && !m_sys_module.unload()) {
META_ERROR("dll: Couldn't close plugin file '%s': %s", m_file, "invalid handle");
m_status = PL_FAILED;
return false;