Leak fixes

Another few fixes for leaks found by Bishwa's valgrind runs.

[Edit]
Logs available here: https://cfengine.com/dev/issues/4166