Previously a child process was used on Unix and
a thread on Windows and they each communicated
with the main thread via pipes which includeded
platform specific code and upon closure on Windows
could result in crash.
Now a thread is used on all platforms with safer
ways of cancellation.
Little behavior should have been changed though timing
of print events are now after connecting finished which
might be a minor issue.
- Removes need to check for malloc failure
- Removes need for NULL checks on free
- Adds checks for integer overflows
- Removes some extra memset calls
- Removes chance of mixing libc and glib malloc/free