File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,8 @@ inline r_vector<SEXP>::r_vector(std::initializer_list<named_arg> il)
7979 : cpp11::r_vector<SEXP>(safe[Rf_allocVector](VECSXP, il.size())),
8080 capacity_ (il.size()) {
8181 unwind_protect ([&] {
82- SEXP names = Rf_allocVector (STRSXP, capacity_);
82+ SEXP names;
83+ PROTECT (names = Rf_allocVector (STRSXP, capacity_));
8384 Rf_setAttrib (data_, R_NamesSymbol, names);
8485
8586 auto it = il.begin ();
@@ -91,6 +92,8 @@ inline r_vector<SEXP>::r_vector(std::initializer_list<named_arg> il)
9192 SEXP name = Rf_mkCharCE (it->name (), CE_UTF8);
9293 SET_STRING_ELT (names, i, name);
9394 }
95+
96+ UNPROTECT (1 );
9497 });
9598}
9699
Original file line number Diff line number Diff line change @@ -865,7 +865,8 @@ inline r_vector<T>::r_vector(std::initializer_list<named_arg> il)
865865 }
866866
867867 unwind_protect ([&] {
868- SEXP names = Rf_allocVector (STRSXP, capacity_);
868+ SEXP names;
869+ PROTECT (names = Rf_allocVector (STRSXP, capacity_));
869870 Rf_setAttrib (data_, R_NamesSymbol, names);
870871
871872 auto it = il.begin ();
@@ -890,6 +891,8 @@ inline r_vector<T>::r_vector(std::initializer_list<named_arg> il)
890891 SEXP name = Rf_mkCharCE (it->name (), CE_UTF8);
891892 SET_STRING_ELT (names, i, name);
892893 }
894+
895+ UNPROTECT (1 );
893896 });
894897}
895898
You can’t perform that action at this time.
0 commit comments