am: fix commit buffer leak in get_commit_info()