Some MEMORY LEAK fixes

When browsing the codes, I found some potential memory leaks, such as objects never freed, memory allocated with 'new[]' but freed with 'delete', etc. So, I used some profiling tools to run the program, just created a new game and quit, there was almost 20MB memory leaks in over 2000 memory blocks.

I fixed some definite memory lost in this fix. And I'm still tracing the others.

p.s. 
I merged some mainstream commits today by mistake, just ignoring commit 232161b pls.