Fixed Bug 8093

Special Thanks to Haruna for pinpointing the cause, developing test cases and contributing to the final solution :3
http://hercules.ws/board/tracker/issue-8093-memory-leak-after-stop-server-cant-fix/

Signed-off-by: shennetsind <ind@henn.et>
Merge branch 'master' of https://github.com/HerculesWS/Hercules