Skip to content

Commit 71e9901

Browse files
protect result from convert_ysing_rfunction()
ScalarLogical() does not allocate
1 parent 97f9a81 commit 71e9901

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

inst/include/Rcpp/DataFrame.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ namespace Rcpp{
101101
if( ::Rf_inherits( x, "data.frame" )){
102102
Parent::set__( x ) ;
103103
} else{
104-
SEXP y = internal::convert_using_rfunction( x, "as.data.frame" ) ;
104+
SEXP y = PROTECT(internal::convert_using_rfunction( x, "as.data.frame" )) ;
105105
Parent::set__( y ) ;
106+
UNPROTECT(1);
106107
}
107108
}
108109

@@ -130,7 +131,7 @@ namespace Rcpp{
130131
obj.erase(strings_as_factors_index) ;
131132
names.erase(strings_as_factors_index) ;
132133
obj.attr( "names") = names ;
133-
Shield<SEXP> call( Rf_lang3(as_df_symb, obj, wrap( strings_as_factors ) ) ) ;
134+
Shield<SEXP> call( Rf_lang3(as_df_symb, obj, Rf_ScalarLogical(strings_as_factors) ) ) ;
134135
SET_TAG( CDDR(call), strings_as_factors_symb ) ;
135136
Shield<SEXP> res(Rcpp_fast_eval(call, R_GlobalEnv));
136137
DataFrame_Impl out( res ) ;

0 commit comments

Comments
 (0)