Fix memory leak in load_config