Fixed incorrect use of Marshal.FreeHGlobal instead of LocalFree