Fix memleak for Config and parent commit objects