Fix memleak in r_reg_free