HPCC-10844 Fix some memory leaks in the code generator

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Merge pull request #5412 from ghalliday/issue10844

HPCC-10844 Fix some memory leaks in the code generator

Reviewed-By: Jamie Noss <james.noss@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Community Edition 4.2.2-rc11 Release Candidate 11

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Merge remote-tracking branch 'origin/candidate-4.2.2' into closedown-4.2.x

Conflicts:
	version.cmake

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>