HPCC-9626 - Clear up various issues spotted by valgrind

A few minor leaks and new/free mismatches

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Merge pull request #4605 from jakesmith/hpcc-9626

HPCC-9626 - Clear up various issues spotted by valgrind

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>