HPCC-9145 Fix some memory leaks

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>