Fixes for various defects detected by clang-analyzer

A set of fixes to address all the defects except for one (#116, wasn't sure what's the right fix) detected by clang-analyer:

- Drop lots of dead code and unusued stuff.
- Fix use-after-free errors because `call` object thinks its a great idea to do `delete this` :anguished:
- Lots of defencive checks for `NULL` because the static analyzer detected potential edge cases.
- Plugged a few detected memory leaks.

Only testing I've done thus far is making sure the built-in uas/uac scenarios still work (they do). I haven't quite had the time to figure out the gtest stuff just yet, but I figured there was nothing wrong putting this up for review before the testing was fully finished.

Still two outstanding warnings (not defects):

- `#warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"`. Wasn't sure if changing over to `_DEFAULT_SOURCE` would have backwards compatability problems or if there's a better solution.
- `-Wimplicit-conversion-floating-point-to-bool` errors around `xp_get_bool`.