update-index: fix xgetcwd() related memory leak