Fix Win32/64 compilation warnings & memory leak