HPCC-10844 Fix some memory leaks in the code generator

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