Skip to content

Commit f2b8c58

Browse files
committed
Keep listNames protected
1 parent 4049561 commit f2b8c58

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/rbindlist.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ SEXP rbindlist(SEXP l, SEXP usenamesArg, SEXP fillArg, SEXP idcolArg, SEXP ignor
250250
setAttrib(ans, R_NamesSymbol, ansNames);
251251
if (idcol) {
252252
SET_STRING_ELT(ansNames, 0, STRING_ELT(idcolArg, 0));
253-
SEXP idval, listNames=getAttrib(l, R_NamesSymbol);
253+
SEXP idval, listNames=PROTECT(getAttrib(l, R_NamesSymbol));
254254
if (length(listNames)) {
255255
SET_VECTOR_ELT(ans, 0, idval=allocVector(STRSXP, nrow));
256256
for (int i=0,ansloc=0; i<LENGTH(l); ++i) {
@@ -270,6 +270,7 @@ SEXP rbindlist(SEXP l, SEXP usenamesArg, SEXP fillArg, SEXP idcolArg, SEXP ignor
270270
for (int k=0; k<thisnrow; ++k) idvald[ansloc++] = i+1;
271271
}
272272
}
273+
UNPROTECT(1); // listNames
273274
}
274275

275276
PROTECT_INDEX IcoercedForFactor;

0 commit comments

Comments
 (0)