From 0e929a56a8ef67aab7fa39485e70071d65d052ad Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Fri, 31 Oct 2014 13:05:08 -0700 Subject: [PATCH] Workaround for strange ScalarLogical behaviour. --- src/validate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/validate.c b/src/validate.c index 60e89e2..26df4c0 100644 --- a/src/validate.c +++ b/src/validate.c @@ -22,7 +22,7 @@ SEXP R_validate(SEXP x) { stat = yajl_complete_parse(hand); } - SEXP output = ScalarLogical(!stat); + SEXP output = PROTECT(duplicate(ScalarLogical(!stat))); //error message if (stat != yajl_status_ok) { @@ -34,5 +34,6 @@ SEXP R_validate(SEXP x) { /* return boolean vec (0 means no errors, means is valid) */ yajl_free(hand); + UNPROTECT(1); return output; }