Use ruby_xfree to free buffers
They are allocated with ruby_xmalloc, they should be freed with ruby_xfree.
This commit is contained in:
parent
32f289d118
commit
698cb84062
@ -1497,7 +1497,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
|
|||||||
case 'u':
|
case 'u':
|
||||||
if (pe > stringEnd - 4) {
|
if (pe > stringEnd - 4) {
|
||||||
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
||||||
free(bufferStart);
|
ruby_xfree(bufferStart);
|
||||||
}
|
}
|
||||||
rb_enc_raise(
|
rb_enc_raise(
|
||||||
EXC_ENCODING eParserError,
|
EXC_ENCODING eParserError,
|
||||||
@ -1510,7 +1510,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
|
|||||||
pe++;
|
pe++;
|
||||||
if (pe > stringEnd - 6) {
|
if (pe > stringEnd - 6) {
|
||||||
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
||||||
free(bufferStart);
|
ruby_xfree(bufferStart);
|
||||||
}
|
}
|
||||||
rb_enc_raise(
|
rb_enc_raise(
|
||||||
EXC_ENCODING eParserError,
|
EXC_ENCODING eParserError,
|
||||||
@ -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));
|
result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart));
|
||||||
}
|
}
|
||||||
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
||||||
free(bufferStart);
|
ruby_xfree(bufferStart);
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart));
|
result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart));
|
||||||
|
|
||||||
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
||||||
free(bufferStart);
|
ruby_xfree(bufferStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intern) {
|
if (intern) {
|
||||||
|
@ -508,7 +508,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
|
|||||||
case 'u':
|
case 'u':
|
||||||
if (pe > stringEnd - 4) {
|
if (pe > stringEnd - 4) {
|
||||||
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
||||||
free(bufferStart);
|
ruby_xfree(bufferStart);
|
||||||
}
|
}
|
||||||
rb_enc_raise(
|
rb_enc_raise(
|
||||||
EXC_ENCODING eParserError,
|
EXC_ENCODING eParserError,
|
||||||
@ -521,7 +521,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int
|
|||||||
pe++;
|
pe++;
|
||||||
if (pe > stringEnd - 6) {
|
if (pe > stringEnd - 6) {
|
||||||
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
||||||
free(bufferStart);
|
ruby_xfree(bufferStart);
|
||||||
}
|
}
|
||||||
rb_enc_raise(
|
rb_enc_raise(
|
||||||
EXC_ENCODING eParserError,
|
EXC_ENCODING eParserError,
|
||||||
@ -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));
|
result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart));
|
||||||
}
|
}
|
||||||
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
||||||
free(bufferStart);
|
ruby_xfree(bufferStart);
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart));
|
result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart));
|
||||||
|
|
||||||
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
if (bufferSize > MAX_STACK_BUFFER_SIZE) {
|
||||||
free(bufferStart);
|
ruby_xfree(bufferStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intern) {
|
if (intern) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user