From b303cd4cea2c31378ee22cea053cd9f60a2fd4e8 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Sun, 21 Jul 2024 10:23:05 -0700 Subject: [PATCH] PROTECT() names vector (#6265) --- src/rbindlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rbindlist.c b/src/rbindlist.c index 24a785bde..e206d4ce4 100644 --- a/src/rbindlist.c +++ b/src/rbindlist.c @@ -243,8 +243,8 @@ SEXP rbindlist(SEXP l, SEXP usenamesArg, SEXP fillArg, SEXP idcolArg) int nprotect = 0; SEXP ans = PROTECT(allocVector(VECSXP, idcol + ncol)); nprotect++; - SEXP ansNames; - setAttrib(ans, R_NamesSymbol, ansNames=allocVector(STRSXP, idcol + ncol)); + SEXP ansNames = PROTECT(allocVector(STRSXP, idcol + ncol)); nprotect++; + setAttrib(ans, R_NamesSymbol, ansNames); if (idcol) { SET_STRING_ELT(ansNames, 0, STRING_ELT(idcolArg, 0)); SEXP idval, listNames=getAttrib(l, R_NamesSymbol);