Skip to content

Commit

Permalink
Non leaking solution
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Jul 28, 2016
1 parent 2baa950 commit fe6f1de
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/jqr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ typedef boost::shared_ptr<jv_parser> jv_parser_ptr;
// typedef std::shared_ptr<jv_parser> jv_parser_ptr;

void jqr_err_cb(void *, jv x) {
const char *msg = jv_string_value(x);
//jv_free(x); // Causes segfaults valgrand / ASAN
Rcpp::stop(msg);
char buf[1000];
strncpy(buf, jv_string_value(x), 1000);
jv_free(x);
Rcpp::stop(buf);
}

void delete_jq_state(jq_state* state) {
Expand Down

0 comments on commit fe6f1de

Please sign in to comment.