fix a memleak in rc_migrate_dir