Fix memory leaks in rtr_sync()