Skip to content

Commit 6f89fae

Browse files
committed
Fix protect bug
1 parent cb6fcdd commit 6f89fae

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/xml2_utils.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ enum NodeType {
1414

1515

1616
inline int inherits3(SEXP x, const char *name) {
17-
SEXP expr = PROTECT(Rf_lang3(Rf_install("inherits"), x, Rf_mkString(name)));
17+
SEXP arg = PROTECT(Rf_mkString(name));
18+
SEXP expr = PROTECT(Rf_lang3(Rf_install("inherits"), x, arg));
1819
SEXP result = PROTECT(Rf_eval(expr, R_GlobalEnv));
1920

2021
int out = LOGICAL(result)[0];
21-
UNPROTECT(2);
22+
UNPROTECT(3);
2223
return out;
2324
}
2425

0 commit comments

Comments
 (0)