windows: fix various memory leaks

This fixes bug #419.
windows: indentation (cosmetics only)