add_reflog_for_walk: avoid memory leak