tool_main: Fixed a memory leak on main_init error