Fix memory leak in r_core_cmd_subst