Fix potential memory leak in src/Format.cpp