From 738490a239c52d3e26e0a95fd6b797d2788e9ae0 Mon Sep 17 00:00:00 2001 From: Benjamin Schwendinger Date: Fri, 26 Dec 2025 18:41:50 +0100 Subject: [PATCH] make rchk happy --- src/subset.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/subset.c b/src/subset.c index b51a33f59..b3372f057 100644 --- a/src/subset.c +++ b/src/subset.c @@ -331,7 +331,7 @@ SEXP subsetDT(SEXP x, SEXP rows, SEXP cols) { // API change needs update NEWS.md SEXP tmp = PROTECT(R_allocResizableVector(STRSXP, LENGTH(cols)+overAlloc)); nprotect++; R_resizeVector(tmp, LENGTH(cols)); setAttrib(ans, R_NamesSymbol, tmp); - subsetVectorRaw(tmp, getAttrib(x, R_NamesSymbol), cols, /*anyNA=*/false); + subsetVectorRaw(tmp, PROTECT(getAttrib(x, R_NamesSymbol)), cols, /*anyNA=*/false); nprotect++; tmp = PROTECT(allocVector(INTSXP, 2)); nprotect++; INTEGER(tmp)[0] = NA_INTEGER; @@ -341,7 +341,7 @@ SEXP subsetDT(SEXP x, SEXP rows, SEXP cols) { // API change needs update NEWS.md // clear any index that was copied over by copyMostAttrib() above, e.g. #1760 and #1734 (test 1678) setAttrib(ans, sym_index, R_NilValue); // but maintain key if ordered subset - SEXP key = getAttrib(x, sym_sorted); + SEXP key = PROTECT(getAttrib(x, sym_sorted)); nprotect++; if (length(key)) { SEXP innames = PROTECT(getAttrib(ans,R_NamesSymbol)); nprotect++; SEXP in = PROTECT(chin(key, innames)); nprotect++; @@ -352,7 +352,7 @@ SEXP subsetDT(SEXP x, SEXP rows, SEXP cols) { // API change needs update NEWS.md setAttrib(ans, sym_sorted, R_NilValue); } else { // make a new key attribute; shorter if i