mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
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
2 changed files with 8 additions and 8 deletions
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue