mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Delete ALL scripts which not assigned instead of delete scripts which not assigned AND its ScriptName not contains the word "example", in Script::RegisterSelf().
So fixes memleaks in scripts which scriptname contains the "example" word AND not assigned(ScriptName column in DB) to an object. This ones fixed: example_creature, example_escort, example_areatrigger, example_item, example_go_teleporter, example_gossip_codebox. Some valgrind log: :) ==31592== 353 (312 direct, 41 indirect) bytes in 1 blocks are definitely lost in loss record 280 of 1,232 ==31592== at 0x4C2626C: operator new(unsigned long) (vg_replace_malloc.c:230) ==31592== by 0xEFAC8A: AddSC_example_creature() (example_creature.cpp:286) ==31592== by 0xDC047A: AddScripts() (ScriptLoader.cpp:523) ==31592== by 0xC183F3: ScriptMgr::ScriptsInit() (ScriptMgr.cpp:70) ==31592== by 0xD1B75F: World::SetInitialWorldSettings() (World.cpp:1608) ==31592== by 0x90F34E: Master::Run() (Master.cpp:234) ==31592== by 0x90E87E: main (Main.cpp:146) ==31592== ==31592== ==31592== 351 (312 direct, 39 indirect) bytes in 1 blocks are definitely lost in loss record 281 of 1,232 ==31592== at 0x4C2626C: operator new(unsigned long) (vg_replace_malloc.c:230) ==31592== by 0xEFB426: AddSC_example_escort() (example_escort.cpp:223) ==31592== by 0xDC047F: AddScripts() (ScriptLoader.cpp:524) ==31592== by 0xC183F3: ScriptMgr::ScriptsInit() (ScriptMgr.cpp:70) ==31592== by 0xD1B75F: World::SetInitialWorldSettings() (World.cpp:1608) ==31592== by 0x90F34E: Master::Run() (Master.cpp:234) ==31592== by 0x90E87E: main (Main.cpp:146) ==31592== ==31592== ==31592== 359 (312 direct, 47 indirect) bytes in 1 blocks are definitely lost in loss record 282 of 1,232 ==31592== at 0x4C2626C: operator new(unsigned long) (vg_replace_malloc.c:230) ==31592== by 0xEFBCB6: AddSC_example_gossip_codebox() (example_gossip_codebox.cpp:93) ==31592== by 0xDC0484: AddScripts() (ScriptLoader.cpp:525) ==31592== by 0xC183F3: ScriptMgr::ScriptsInit() (ScriptMgr.cpp:70) ==31592== by 0xD1B75F: World::SetInitialWorldSettings() (World.cpp:1608) ==31592== by 0x90F34E: Master::Run() (Master.cpp:234) ==31592== by 0x90E87E: main (Main.cpp:146) ==31592== ==31592== ==31592== 358 (312 direct, 46 indirect) bytes in 1 blocks are definitely lost in loss record 283 of 1,232 ==31592== at 0x4C2626C: operator new(unsigned long) (vg_replace_malloc.c:230) ==31592== by 0xEFC04B: AddSC_example_misc() (example_misc.cpp:65) ==31592== by 0xDC0489: AddScripts() (ScriptLoader.cpp:526) ==31592== by 0xC183F3: ScriptMgr::ScriptsInit() (ScriptMgr.cpp:70) ==31592== by 0xD1B75F: World::SetInitialWorldSettings() (World.cpp:1608) ==31592== by 0x90F34E: Master::Run() (Master.cpp:234) ==31592== by 0x90E87E: main (Main.cpp:146) ==31592== ==31592== ==31592== 356 (312 direct, 44 indirect) bytes in 1 blocks are definitely lost in loss record 501 of 1,232 ==31592== at 0x4C2626C: operator new(unsigned long) (vg_replace_malloc.c:230) ==31592== by 0xEFBF96: AddSC_example_misc() (example_misc.cpp:55) ==31592== by 0xDC0489: AddScripts() (ScriptLoader.cpp:526) ==31592== by 0xC183F3: ScriptMgr::ScriptsInit() (ScriptMgr.cpp:70) ==31592== by 0xD1B75F: World::SetInitialWorldSettings() (World.cpp:1608) ==31592== by 0x90F34E: Master::Run() (Master.cpp:234) ==31592== by 0x90E87E: main (Main.cpp:146) ==31592== ==31592== ==31592== 349 (312 direct, 37 indirect) bytes in 1 blocks are definitely lost in loss record 1,209 of 1,232 ==31592== at 0x4C2626C: operator new(unsigned long) (vg_replace_malloc.c:230) ==31592== by 0xEFBFDB: AddSC_example_misc() (example_misc.cpp:60) ==31592== by 0xDC0489: AddScripts() (ScriptLoader.cpp:526) ==31592== by 0xC183F3: ScriptMgr::ScriptsInit() (ScriptMgr.cpp:70) ==31592== by 0xD1B75F: World::SetInitialWorldSettings() (World.cpp:1608) ==31592== by 0x90F34E: Master::Run() (Master.cpp:234) ==31592== by 0x90E87E: main (Main.cpp:146) --HG-- branch : trunk
This commit is contained in:
@@ -164,9 +164,10 @@ void Script::RegisterSelf()
|
||||
m_scripts[id] = this;
|
||||
++num_sc_scripts;
|
||||
}
|
||||
else if (Name.find("example") == std::string::npos)
|
||||
else
|
||||
{
|
||||
error_db_log("TrinityScript: RegisterSelf, but script named %s does not have ScriptName assigned in database.",(this)->Name.c_str());
|
||||
if (Name.find("example") == std::string::npos)
|
||||
error_db_log("TrinityScript: RegisterSelf, but script named %s does not have ScriptName assigned in database.",(this)->Name.c_str());
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user