rebuild_wim(): Fix use of freed memory