Skip to content

Commit 3c9787c

Browse files
committed
Fixing PROTECT issue to fix rchk
1 parent 729c587 commit 3c9787c

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: filearray
22
Type: Package
33
Title: File-Backed Array for Out-of-Memory Computation
4-
Version: 0.2.0.9000
4+
Version: 0.2.0.9001
55
Language: en-US
66
Encoding: UTF-8
77
License: LGPL-3

src/utils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,10 @@ SEXP dropDimension(SEXP x){
207207
// return(Rf_DropDims(x));
208208

209209
PROTECT(x);
210-
SEXP dims = Rf_getAttrib(x, R_DimSymbol);
210+
SEXP dims = PROTECT(Rf_getAttrib(x, R_DimSymbol));
211211

212212
if (dims == R_NilValue) {
213-
UNPROTECT(1);
213+
UNPROTECT(2);
214214
return x;
215215
}
216216

@@ -222,7 +222,7 @@ SEXP dropDimension(SEXP x){
222222
if (dim[i] != 1) n++;
223223
}
224224
if (n == ndims) {
225-
UNPROTECT(1);
225+
UNPROTECT(2);
226226
return x;
227227
}
228228

@@ -310,7 +310,7 @@ SEXP dropDimension(SEXP x){
310310
}
311311
UNPROTECT(2);
312312
}
313-
UNPROTECT(2);
313+
UNPROTECT(3);
314314
return x;
315315
}
316316

0 commit comments

Comments
 (0)