Fixes compiler and valgrind warnings

- Removed strdup for now because it's not compatible with current
  C standard settings (http://stackoverflow.com/a/13426660).
- Fixes a few hastily added string terminations.