HPCC-10876 Fix various issues highlighted by coverity scan

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