From 67865b805f1e304feb63ff68a2342d94794e2409 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 15 Jul 2024 13:57:15 -0700 Subject: [PATCH] PROTECT() names vector --- src/rbindlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rbindlist.c b/src/rbindlist.c index 5fd4cf7000..c35acda851 100644 --- a/src/rbindlist.c +++ b/src/rbindlist.c @@ -242,8 +242,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);