summaryrefslogtreecommitdiff
path: root/ext/json/ext/parser
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/ext/parser')
-rw-r--r--ext/json/ext/parser/parser.c2
-rw-r--r--ext/json/ext/parser/unicode.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c
index 5a5d6f1dc4..25a8ae1926 100644
--- a/ext/json/ext/parser/parser.c
+++ b/ext/json/ext/parser/parser.c
@@ -1705,7 +1705,7 @@ static void JSON_mark(JSON_Parser *json)
static void JSON_free(JSON_Parser *json)
{
- free(json);
+ ruby_xfree(json);
}
static VALUE cJSON_parser_s_allocate(VALUE klass)
diff --git a/ext/json/ext/parser/unicode.c b/ext/json/ext/parser/unicode.c
index 609a0e83e2..f196727354 100644
--- a/ext/json/ext/parser/unicode.c
+++ b/ext/json/ext/parser/unicode.c
@@ -105,12 +105,12 @@ char *JSON_convert_UTF16_to_UTF8 (
+ (ch2 - UNI_SUR_LOW_START) + halfBase;
++tmpPtr;
} else if (flags == strictConversion) { /* it's an unpaired high surrogate */
- free(tmp);
+ ruby_xfree(tmp);
rb_raise(rb_path2class("JSON::ParserError"),
"source sequence is illegal/malformed near %s", source);
}
} else { /* We don't have the 16 bits following the high surrogate. */
- free(tmp);
+ ruby_xfree(tmp);
rb_raise(rb_path2class("JSON::ParserError"),
"partial character in source, but hit end near %s", source);
break;
@@ -118,7 +118,7 @@ char *JSON_convert_UTF16_to_UTF8 (
} else if (flags == strictConversion) {
/* UTF-16 surrogate values are illegal in UTF-32 */
if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
- free(tmp);
+ ruby_xfree(tmp);
rb_raise(rb_path2class("JSON::ParserError"),
"source sequence is illegal/malformed near %s", source);
}
@@ -150,7 +150,7 @@ char *JSON_convert_UTF16_to_UTF8 (
}
rb_str_buf_cat(buffer, p, bytesToWrite);
}
- free(tmp);
+ ruby_xfree(tmp);
source += 5 + (n - 1) * 6;
return source;
}