Fix leaks & errors.
Use ctest instead of make test