Core/Scripts: Fix invalid memory write

Fix invalid memory write caused by calling "delete this;" in a base class constructor.
This commit is contained in:
jackpoz
2014-09-29 20:12:03 +02:00
parent c34af1d60b
commit 4ed3254aa8

View File

@@ -104,7 +104,10 @@ class ScriptRegistry
// The script uses a script name from database, but isn't assigned to anything.
TC_LOG_ERROR("sql.sql", "Script named '%s' does not have a script name assigned in database.", script->GetName().c_str());
delete script;
// Avoid calling "delete script;" because we are currently in the script constructor
// In a valid scenario this will not happen because every script has a name assigned in the database
// If that happens, it's acceptable to just leak a few bytes
return;
}
}