Skip to content

Commit

Permalink
Merge branch 'Shopify-use-xfree'
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Dec 1, 2023
2 parents fa4725f + a014673 commit 77ac074
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions ext/json/ext/parser/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
case 'u':
if (pe > stringEnd - 4) {
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
free(bufferStart);
ruby_xfree(bufferStart);
}
rb_enc_raise(
EXC_ENCODING eParserError,
Expand All @@ -1510,7 +1510,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
pe++;
if (pe > stringEnd - 6) {
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
free(bufferStart);
ruby_xfree(bufferStart);
}
rb_enc_raise(
EXC_ENCODING eParserError,
Expand Down Expand Up @@ -1555,13 +1555,13 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart));
}
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
free(bufferStart);
ruby_xfree(bufferStart);
}
# else
result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart));

if (bufferSize > MAX_STACK_BUFFER_SIZE) {
free(bufferStart);
ruby_xfree(bufferStart);
}

if (intern) {
Expand Down
8 changes: 4 additions & 4 deletions ext/json/ext/parser/parser.rl
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
case 'u':
if (pe > stringEnd - 4) {
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
free(bufferStart);
ruby_xfree(bufferStart);
}
rb_enc_raise(
EXC_ENCODING eParserError,
Expand All @@ -521,7 +521,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
pe++;
if (pe > stringEnd - 6) {
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
free(bufferStart);
ruby_xfree(bufferStart);
}
rb_enc_raise(
EXC_ENCODING eParserError,
Expand Down Expand Up @@ -566,13 +566,13 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart));
}
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
free(bufferStart);
ruby_xfree(bufferStart);
}
# else
result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart));

if (bufferSize > MAX_STACK_BUFFER_SIZE) {
free(bufferStart);
ruby_xfree(bufferStart);
}

if (intern) {
Expand Down

0 comments on commit 77ac074

Please sign in to comment.