Fix bugs found by Cppcheck

I tried to use Cppcheck(1.65) to figure out the difference between Cppcheck and CppCat after reviewing [Issue 2194](https://code.google.com/p/tortoisegit/issues/detail?id=2194).
Actually, I don't get much, but try to fix some bugs if they really are. :)