Clean up merge memleaks

Clean up memory leaks in header manipulation code

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>