Fix memory issues, integer overflow, undefined behavior

These patch series fix 32 bugs reported by clang static analyzer (18 memory leaks, 11 use of undefined variables). Two unfixed bugs are at #35.

Note for "Set display_name field", if ABI breakage is allowed in the future, this field can probably be dropped.

Besides the bunch of memory leaks fixes, there are also other changes for unusual code paths:

- cmd_key: fix crash due to invalid calculation: `xdotool key shift+shift+shift+shift+shift+shift+shift+shift+shift+x`
- cmd_{type,exec}: these now crash if you use `xdotool type --terminator x x`
- Scripts can crash by using positional parameters that wrap negative (integer overflow): `echo '$4294967294' | xdotool -`

Fixes that are normally useful:

- Regexes are now pre-compiled, this should give some milliseconds better performance and error only out once when an invalid regex is encountered (e.g. `xdotool search --name '*'`)
- `xdotool search --name Firefox type foo` now types in the correct window.