Winpr clang error fixes

* Fixes numerous memory leaks, use after free and double free bugs.
* Fixes ```autoformat.sh``` script, ```format_code.sh``` now uses bash
* ```format_code.sh``` now removes backup files created by ```astyle```
* Reformatted all files touched with ```autoformat.sh```